Class: CreateOrchestrated

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

Class Method Summary collapse

Class Method Details

.downObject



25
26
27
28
29
# File 'lib/generators/orchestrated/templates/migration.rb', line 25

def self.down
  drop_table :orchestration_dependencies
  drop_table :completion_expressions
  drop_table :orchestrations
end

.upObject



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

def self.up
  create_table :orchestrations do |table|
    table.string     :state
    table.text       :handler
    table.references :prerequisite
    table.references :delayed_job, :polymorphic => true
    table.timestamps
  end
  create_table :completion_expressions do |table|
    table.string     :type
    # only one kind of completion expression needs this
    # (OrchestrationCompletion) but I didn't want to put
    # it in a separate table because it would really contort
    # the Rails model
    table.references :orchestration
  end
  create_table :orchestration_dependencies do |table|
    table.string     :state
    table.references :dependent
    table.references :prerequisite
  end
end