Skip to content

Commit 8379e75

Browse files
committed
setting bigints, massaging FK adds
1 parent c798e26 commit 8379e75

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

db/migrate/20251028201000_create_team.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
class CreateTeam < ActiveRecord::Migration[7.1]
22
def up
3-
create_table :teams, primary_key: :id do |t|
4-
t.integer :id
5-
t.integer :workspace_id
3+
create_table :teams do |t|
4+
t.bigint :workspace_id
65
t.string :name
76
end
87

98
add_index :teams, [:workspace_id, :name], unique: true
109

11-
create_table :team_user do |t|
12-
t.integer :team_id, null: false
13-
t.integer :user_id, null: false
10+
create_table :team_user, id: false do |t|
11+
t.bigint :team_id, null: false
12+
t.bigint :user_id, null: false
1413
end
1514

1615
add_index :team_user, [:team_id, :user_id], unique: true
17-
add_foreign_key :team_user, :teams, column: :team_id
18-
add_foreign_key :team_user, :users, column: :user_id
16+
17+
add_foreign_key :team_user, :teams, column: :team_id, validate: false
18+
add_foreign_key :team_user, :users, column: :user_id, validate: false
1919
end
2020

2121
def down

0 commit comments

Comments
 (0)