Sha256: c4a73558b1a1e294991a84c1470e94560076a00a314436ecccab7f9cec07ce93

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

# encoding: utf-8

class CreateSayWhenTables < ActiveRecord::Migration

  def self.up

    create_table :<%= prefix %>say_when_jobs, :force => true do |t|
      t.string    :group
      t.string    :name

      t.string    :status

      t.string    :trigger_strategy
      t.text      :trigger_options

      t.timestamp :last_fire_at
      t.timestamp :next_fire_at

      t.timestamp :start_at
      t.timestamp :end_at

      t.string    :job_class
      t.string    :job_method
      t.text      :data

      t.string    :scheduled_type
      t.integer   :scheduled_id

      t.timestamps null: false
    end

    add_index :<%= prefix %>say_when_jobs, [:next_fire_at, :status]
    add_index :<%= prefix %>say_when_jobs, [:scheduled_type, :scheduled_id]

    create_table :<%= prefix %>say_when_job_executions, :force => true do |t|
      t.integer  :job_id
      t.string   :status
      t.text     :result
      t.datetime :start_at
      t.datetime :end_at
    end

    add_index :<%= prefix %>say_when_job_executions, :job_id
    add_index :<%= prefix %>say_when_job_executions, [:status, :start_at, :end_at]
  end

  def self.down
    drop_table :<%= prefix %>say_when_job_executions
    drop_table :<%= prefix %>say_when_jobs
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
say_when-2.2.2 lib/generators/say_when/migration/templates/migration.rb
say_when-2.2.1 lib/generators/say_when/migration/templates/migration.rb
say_when-2.2.0 lib/generators/say_when/migration/templates/migration.rb
say_when-2.1.1 lib/generators/say_when/migration/templates/migration.rb
say_when-2.1.0 lib/generators/say_when/migration/templates/migration.rb