# frozen_string_literal: true

class CreateUxToolkitRecentIssues < ActiveRecord::Migration[6.1]
  def change
    create_table :ux_toolkit_recent_issues do |t|
      t.integer :user_id, null: false
      t.integer :issue_id, null: false
      t.datetime :last_visited_at, null: false
      t.timestamps
    end

    add_index :ux_toolkit_recent_issues,
              [:user_id, :issue_id],
              unique: true,
              name: 'idx_ux_toolkit_recent_issues_unique'
    add_index :ux_toolkit_recent_issues, :user_id
    add_index :ux_toolkit_recent_issues, :issue_id
    add_index :ux_toolkit_recent_issues, :last_visited_at
  end
end
