# frozen_string_literal: true

class CreateUxToolkitChecklistItems < ActiveRecord::Migration[6.1]
  def change
    create_table :ux_toolkit_checklist_items do |t|
      t.integer :issue_id, null: false
      t.string :subject, null: false
      t.boolean :is_done, null: false, default: false
      t.integer :position, null: false, default: 1
      t.integer :created_by_id
      t.integer :updated_by_id
      t.timestamps
    end

    add_index :ux_toolkit_checklist_items, :issue_id
    add_index :ux_toolkit_checklist_items, :created_by_id
    add_index :ux_toolkit_checklist_items, :updated_by_id
    add_index :ux_toolkit_checklist_items, [:issue_id, :position]
  end
end
