20220714171049_create_tag_follows.rb 376 B

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