fedibird-fe/db/migrate/20200318135004_create_emoji_reactions.rb

17 lines
553 B
Ruby
Raw Normal View History

2021-05-19 05:58:27 +00:00
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