# frozen_string_literal: true

class CreateUxToolkitCronStates < ActiveRecord::Migration[6.1]
  def change
    create_table :ux_toolkit_cron_states do |t|
      t.string :name, null: false
      t.datetime :last_started_at
      t.datetime :last_finished_at
      t.string :last_status
      t.text :last_message
      t.datetime :locked_until
      t.timestamps
    end

    add_index :ux_toolkit_cron_states, :name, unique: true
    add_index :ux_toolkit_cron_states, :locked_until
  end
end
