class CreateAsyncActiveJobs < ActiveRecord::Migration<%= migration_version %> def up create_table :async_active_jobs do |t| t.string :queue_name t.integer :priority, limit: 2, default: 0, null: false t.integer :attempts, limit: 2, default: 0, null: false t.json :job_data, null: false t.text :last_error t.timestamp :run_at t.timestamp :locked_at t.string :locked_by t.timestamp :failed_at t.timestamps null: false end add_index :async_active_jobs, :priority, name: 'async_active_jobs_priority_idx' add_index :async_active_jobs, :run_at, name: 'async_active_jobs_run_at_idx' add_index :async_active_jobs, :locked_at, name: 'async_active_jobs_locked_at_idx' add_index :async_active_jobs, :queue_name, name: 'async_active_jobs_queue_name_idx' end def down drop_table :async_active_jobs end end