about summary refs log tree commit diff
path: root/app/models/account.rb
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 /app/models/account.rb
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 'app/models/account.rb')
-rw-r--r--app/models/account.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 88f16026d..3dc2a95ab 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -91,8 +91,8 @@ class Account < ApplicationRecord
   has_many :targeted_reports, class_name: 'Report', foreign_key: :target_account_id
 
   # Moderation notes
-  has_many :account_moderation_notes
-  has_many :targeted_moderation_notes, class_name: 'AccountModerationNote', foreign_key: :target_account_id
+  has_many :account_moderation_notes, dependent: :destroy
+  has_many :targeted_moderation_notes, class_name: 'AccountModerationNote', foreign_key: :target_account_id, dependent: :destroy
 
   scope :remote, -> { where.not(domain: nil) }
   scope :local, -> { where(domain: nil) }