mastodon/app/models/account_moderation_note.rb
nullkal 6c54d2e583 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
2017-10-10 13:12:17 +02:00

21 lines
643 B
Ruby

# frozen_string_literal: true
# == Schema Information
#
# Table name: account_moderation_notes
#
# id :integer not null, primary key
# content :text not null
# account_id :integer not null
# target_account_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class AccountModerationNote < ApplicationRecord
belongs_to :account
belongs_to :target_account, class_name: 'Account'
scope :latest, -> { reorder('created_at DESC') }
validates :content, presence: true, length: { maximum: 500 }
end