Class: CreateDelayedJobsHistory

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/delayed_job_memento/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



20
21
22
# File 'lib/generators/delayed_job_memento/templates/migration.rb', line 20

def self.down
  drop_table :delayed_jobs_history
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/delayed_job_memento/templates/migration.rb', line 2

def self.up
  create_table :delayed_jobs_history, force: true do |t|
    t.datetime :created_at                                  # when job was completed
    t.text     :handler, null: false
    t.string   :queue
    t.datetime :locked_at
    t.string   :locked_by
    t.datetime :failed_at
    t.integer  :priority, default: 0, null: false
    t.datetime :run_at
    t.integer  :attempts, default: 0, null: false
    t.text     :last_error
    t.datetime :updated_at
  end

  add_index :delayed_jobs_history, :created_at, name: 'delayed_jobs_completed'
end