about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authornullkal <nullkal@nil.nu>2017-10-10 20:12:17 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-10-10 13:12:17 +0200
commit6c54d2e5837de941457371e9afffd05606d88180 (patch)
tree9f1b3d466755ef356ebf1bb1c3a943ba28fce75a /db/migrate
parent96c942e8abf7bf04e6c3dbcc48cbec07138c486c (diff)
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
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20171010023049_add_foreign_key_to_account_moderation_notes.rb5
-rw-r--r--db/migrate/20171010025614_change_accounts_nonnullable_in_account_moderation_notes.rb6
2 files changed, 11 insertions, 0 deletions
diff --git a/db/migrate/20171010023049_add_foreign_key_to_account_moderation_notes.rb b/db/migrate/20171010023049_add_foreign_key_to_account_moderation_notes.rb
new file mode 100644
index 000000000..fc1e1ab91
--- /dev/null
+++ b/db/migrate/20171010023049_add_foreign_key_to_account_moderation_notes.rb
@@ -0,0 +1,5 @@
+class AddForeignKeyToAccountModerationNotes < ActiveRecord::Migration[5.1]
+  def change
+    add_foreign_key :account_moderation_notes, :accounts
+  end
+end
diff --git a/db/migrate/20171010025614_change_accounts_nonnullable_in_account_moderation_notes.rb b/db/migrate/20171010025614_change_accounts_nonnullable_in_account_moderation_notes.rb
new file mode 100644
index 000000000..747e5a826
--- /dev/null
+++ b/db/migrate/20171010025614_change_accounts_nonnullable_in_account_moderation_notes.rb
@@ -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