20200114113335_create_announcement_reactions.rb 598 B

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