Class: CreateDuctworkSteps
- Inherits:
-
Ductwork::Migration
- Object
- Ductwork::Migration
- CreateDuctworkSteps
- Defined in:
- lib/generators/ductwork/install/templates/db/create_ductwork_steps.rb
Instance Method Summary collapse
Methods included from Ductwork::MigrationHelper
#belongs_to, #create_ductwork_table, #mysql?, #postgresql?, #uuid_column_type
Instance Method Details
#change ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/ductwork/install/templates/db/create_ductwork_steps.rb', line 4 def change create_ductwork_table :ductwork_steps do |table| belongs_to( table, :run, index: true, null: false, foreign_key: { to_table: :ductwork_runs } ) belongs_to( table, :branch, index: true, null: false, foreign_key: { to_table: :ductwork_branches } ) belongs_to( table, :source_step, index: true, null: true, foreign_key: { to_table: :ductwork_steps } ) table.string :node, null: false table.string :klass, null: false table.string :to_transition, null: false table. :started_at table. :completed_at table.string :status, null: false table.integer :delay_seconds table.integer :timeout_seconds table. null: false end add_index :ductwork_steps, %i[branch_id started_at] add_index :ductwork_steps, %i[run_id node status] add_index :ductwork_steps, %i[run_id status node] add_index :ductwork_steps, %i[status branch_id] add_index :ductwork_steps, %i[status node] end |