Class: AddRoleToDuctworkProcesses

Inherits:
Ductwork::Migration show all
Defined in:
lib/generators/ductwork/update/templates/db/add_role_to_ductwork_processes.rb

Instance Method Summary collapse

Methods included from Ductwork::MigrationHelper

#belongs_to, #create_ductwork_table, #mysql?, #postgresql?, #uuid_column_type

Instance Method Details

#downObject



17
18
19
# File 'lib/generators/ductwork/update/templates/db/add_role_to_ductwork_processes.rb', line 17

def down
  remove_column :ductwork_processes, :role, :string
end

#upObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/ductwork/update/templates/db/add_role_to_ductwork_processes.rb', line 4

def up
  add_column :ductwork_processes, :role, :string

  # NOTE: ideally there are no process records that exist because the
  # ductwork process should not be running. either way, we explicitly
  # don't set it to supervisor so it won't report in the health checks
  Ductwork::Process
    .where(role: nil)
    .update_all(role: "pipeline_advancer")

  change_column_null :ductwork_executions, :crash_count, false
end