Sha256: ccc7c8a5383779240a47355422dbae90eee0e5574efffe42f119ba86626936d2

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 KB

Contents

class CreateCronoTriggerSystemTables < ActiveRecord::Migration<%= Rails::VERSION::MAJOR >= 5 ? "[#{ActiveRecord::Migration.current_version}]" : "" %>
  def change
    create_table :crono_trigger_workers, id: :string, primary_key: :worker_id do |t|
      t.integer  :max_thread_size, null: false
      t.integer  :current_executing_size, null: false
      t.integer  :current_queue_size, null: false
      t.string   :executor_status, null: false
      t.string   :polling_model_names, null: false
      t.datetime :last_heartbeated_at, null: false
    end

    add_index :crono_trigger_workers, :last_heartbeated_at

    create_table :crono_trigger_signals do |t|
      t.string :worker_id, null: false
      t.string :signal, null: false
      t.datetime :sent_at, null: false
      t.datetime :received_at
    end

    add_index :crono_trigger_signals, [:sent_at, :worker_id]

    create_table :crono_trigger_executions do |t|
      t.integer :schedule_id, null: false
      t.string :schedule_type, null: false
      t.string :worker_id, null: false
      t.datetime :executed_at, null: false
      t.datetime :completed_at
      t.string :status, null: false, default: "executing"
      t.string :error_name
      t.string :error_reason
    end

    add_index :crono_trigger_executions, [:schedule_type, :schedule_id, :executed_at], name: "index_crono_trigger_executions_on_schtype_schid_executed_at"
    add_index :crono_trigger_executions, [:schedule_type, :executed_at]
    add_index :crono_trigger_executions, [:executed_at]
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
crono_trigger-0.8.3 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.8.1 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.8.0 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.7.1 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.7.0 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.6.4 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.6.3 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.6.2 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.6.1 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.6.0 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.5.4 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.5.3 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.5.2 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.5.1 lib/generators/crono_trigger/install/templates/install.rb
crono_trigger-0.5.0 lib/generators/crono_trigger/install/templates/install.rb