Sha256: 9b2895b4dda526ef1f508e172a7857930feb1179257dab90ff6de65859c35eae

Contents?: true

Size: 1.17 KB

Versions: 12

Compression:

Stored size: 1.17 KB

Contents

class CreateDelayedJobs < ActiveRecord::Migration[5.1]
  def change
    create_table :delayed_jobs do |t|
      t.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
      t.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
      t.text :handler,                 null: false # YAML-encoded string of the object that will do work
      t.text :last_error                           # reason for last failure (See Note below)
      t.datetime :run_at                           # When to run. Could be Time.zone.now for immediately, or sometime in the future.
      t.datetime :locked_at                        # Set when a client is working on this object
      t.datetime :failed_at                        # Set when all retries have failed (actually, by default, the record is deleted instead)
      t.string :locked_by                          # Who is working on this object (if locked)
      t.string :queue                              # The name of the queue this job is in
      t.timestamps null: true
    end

    add_index :delayed_jobs, [:priority, :run_at], name: "delayed_jobs_priority"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
journaled-2.5.0 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.4.0 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.3.1 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.3.0 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.2.0 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.1.1 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.1.0 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.0.3 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.0.2 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.0.1 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.0.0 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb
journaled-2.0.0.rc1 spec/dummy/db/migrate/20180606205114_create_delayed_jobs.rb