Sha256: 165d84f932ae31b9afd5e325f22eafa2f0b8a00a4739597f2ce63a01ded569a1

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

class AddProgressToDelayedJobs < ActiveRecord::Migration

  def self.up
    change_table :delayed_jobs do |t|
      t.string    :identifier
      t.string    :record_type
      t.integer   :record_id
      t.integer   :progress_current,  :null => false, :default => 0
      t.integer   :progress_max,      :null => false, :default => 100
      t.string    :progress_state
      t.datetime  :completed_at
    end

    add_index :delayed_jobs, :identifier
    add_index :delayed_jobs, [:record_type, :record_id]
    add_index :delayed_jobs, :completed_at
  end

  def self.down
    remove_column :delayed_jobs, :identifier
    remove_column :delayed_jobs, :record_type
    remove_column :delayed_jobs, :record_id
    remove_column :delayed_jobs, :progress_current
    remove_column :delayed_jobs, :progress_max
    remove_column :delayed_jobs, :progress_state
    remove_column :delayed_jobs, :completed_at
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
delayed_job_progress-0.0.1 lib/delayed_job_progress/generators/delayed_job/templates/progress_migration.rb