add foreign key to conferences
This commit is contained in:
parent
cce3ff7aea
commit
949f5cb591
1 changed files with 3 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ class MoveConferencesToOrganizations < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
|
|
||||||
def change
|
def change
|
||||||
add_reference :conferences, :organization, index: true, foreign_key: true
|
add_reference :conferences, :organization, index: true
|
||||||
|
|
||||||
TempConference.reset_column_information
|
TempConference.reset_column_information
|
||||||
if TempConference.count != 0
|
if TempConference.count != 0
|
||||||
|
|
@ -18,5 +18,7 @@ class MoveConferencesToOrganizations < ActiveRecord::Migration
|
||||||
conference.save!
|
conference.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_foreign_key :conferences, :organizations, null: false, on_delete: :cascade
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue