add foreign key to conferences

This commit is contained in:
shlok007 2017-06-07 12:37:30 +05:30
parent cce3ff7aea
commit 949f5cb591

View file

@ -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