fedibird-fe/db/migrate/20200318135004_create_emoji_reactions.rb
2022-05-11 00:48:03 +09:00

16 lines
553 B
Ruby

class CreateEmojiReactions < ActiveRecord::Migration[5.2]
def change
create_table :emoji_reactions do |t|
t.belongs_to :account, foreign_key: { on_delete: :cascade, index: false }
t.belongs_to :status, foreign_key: { on_delete: :cascade }
t.string :name, null: false, default: ''
t.belongs_to :custom_emoji, foreign_key: { on_delete: :cascade }
t.timestamps
end
add_index :emoji_reactions, [:account_id, :status_id, :name], unique: true, name: :index_emoji_reactions_on_account_id_and_status_id
end
end