about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb4
-rw-r--r--app/models/account_moderation_note.rb5
2 files changed, 4 insertions, 5 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) }
diff --git a/app/models/account_moderation_note.rb b/app/models/account_moderation_note.rb
index be52d10b6..3ac9b1ac1 100644
--- a/app/models/account_moderation_note.rb
+++ b/app/models/account_moderation_note.rb
@@ -1,13 +1,12 @@
 # frozen_string_literal: true
-
 # == Schema Information
 #
 # Table name: account_moderation_notes
 #
 #  id                :integer          not null, primary key
 #  content           :text             not null
-#  account_id        :integer
-#  target_account_id :integer
+#  account_id        :integer          not null
+#  target_account_id :integer          not null
 #  created_at        :datetime         not null
 #  updated_at        :datetime         not null
 #