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) }
# 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
#
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20171006142024) do
+ActiveRecord::Schema.define(version: 20171010025614) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "account_moderation_notes", force: :cascade do |t|
t.text "content", null: false
- t.bigint "account_id"
- t.bigint "target_account_id"
+ t.bigint "account_id", null: false
+ t.bigint "target_account_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["account_id"], name: "index_account_moderation_notes_on_account_id"
end
add_foreign_key "account_domain_blocks", "accounts", name: "fk_206c6029bd", on_delete: :cascade
+ add_foreign_key "account_moderation_notes", "accounts"
add_foreign_key "account_moderation_notes", "accounts", column: "target_account_id"
add_foreign_key "blocks", "accounts", column: "target_account_id", name: "fk_9571bfabc1", on_delete: :cascade
add_foreign_key "blocks", "accounts", name: "fk_4269e03e65", on_delete: :cascade