about summary refs log tree commit diff
path: root/db/migrate/20200113125135_create_announcement_mutes.rb
blob: c588e7fcd37105c23c70f44e373b6195f05ce567 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
class CreateAnnouncementMutes < ActiveRecord::Migration[5.2]
  def change
    create_table :announcement_mutes do |t|
      t.belongs_to :account, foreign_key: { on_delete: :cascade, index: false }
      t.belongs_to :announcement, foreign_key: { on_delete: :cascade }

      t.timestamps
    end

    add_index :announcement_mutes, [:account_id, :announcement_id], unique: true
  end
end