20220714171049_create_tag_follows.rb 407 B

1234567891011121314
  1. # frozen_string_literal: true
  2. class CreateTagFollows < ActiveRecord::Migration[6.1]
  3. def change
  4. create_table :tag_follows do |t|
  5. t.belongs_to :tag, null: false, foreign_key: { on_delete: :cascade }
  6. t.belongs_to :account, null: false, foreign_key: { on_delete: :cascade }, index: false
  7. t.timestamps
  8. end
  9. add_index :tag_follows, [:account_id, :tag_id], unique: true
  10. end
  11. end