foreign_key, non-nullable, dependent: destroy in account_moderation_notes (#5294)

* Add foreign key constraint to column `account` in `account_moderation_notes`

* Change account_id and target_account_id to non-nullable in account_moderation_notes

* Add dependent: :destroy to account and target_account in account_moderation_notes
This commit is contained in:
nullkal 2017-10-10 20:12:17 +09:00 committed by Eugen Rochko
parent 96c942e8ab
commit 6c54d2e583
5 changed files with 19 additions and 8 deletions

View file

@ -0,0 +1,5 @@
class AddForeignKeyToAccountModerationNotes < ActiveRecord::Migration[5.1]
def change
add_foreign_key :account_moderation_notes, :accounts
end
end

View file

@ -0,0 +1,6 @@
class ChangeAccountsNonnullableInAccountModerationNotes < ActiveRecord::Migration[5.1]
def change
change_column_null :account_moderation_notes, :account_id, false
change_column_null :account_moderation_notes, :target_account_id, false
end
end