# frozen_string_literal: true

class CreateUxToolkitTrackerTicketTemplates < ActiveRecord::Migration[6.1]
  def change
    create_table :ux_toolkit_tracker_ticket_templates do |t|
      t.integer :tracker_id, null: false
      t.integer :project_id
      t.integer :ticket_template_id
      t.boolean :enabled, null: false, default: true
      t.timestamps
    end

    add_index :ux_toolkit_tracker_ticket_templates,
              [:tracker_id, :project_id],
              name: 'index_ux_toolkit_tracker_ticket_templates_on_scope'
    add_index :ux_toolkit_tracker_ticket_templates,
              :ticket_template_id,
              name: 'index_ux_toolkit_tracker_ticket_templates_on_template'
    add_index :ux_toolkit_tracker_ticket_templates,
              :enabled,
              name: 'index_ux_toolkit_tracker_ticket_templates_on_enabled'
  end
end
