20200114113335_create_announcement_reactions.rb 629 B

1234567891011121314151617
  1. # frozen_string_literal: true
  2. class CreateAnnouncementReactions < ActiveRecord::Migration[5.2]
  3. def change
  4. create_table :announcement_reactions do |t|
  5. t.belongs_to :account, foreign_key: { on_delete: :cascade, index: false }
  6. t.belongs_to :announcement, foreign_key: { on_delete: :cascade }
  7. t.string :name, null: false, default: ''
  8. t.belongs_to :custom_emoji, foreign_key: { on_delete: :cascade }
  9. t.timestamps
  10. end
  11. add_index :announcement_reactions, [:account_id, :announcement_id, :name], unique: true, name: :index_announcement_reactions_on_account_id_and_announcement_id
  12. end
  13. end