Sha256: 90b72150b9461f48776efbc31b48ac620a77e481142e13f9c45355b18874bebe

Contents?: true

Size: 518 Bytes

Versions: 1

Compression:

Stored size: 518 Bytes

Contents

class MigrateToTaskGroups < ActiveRecord::Migration
  class FakeJobInvocation < ActiveRecord::Base
    set_table_name 'job_invocations'
  end

  def up
    say 'Migrating from locks to task groups'
    FakeJobInvocation.where('task_group_id IS NULL AND task_id IS NOT NULL').each do |job_invocation|
      task_group = JobInvocationTaskGroup.new
      task_group.task_ids = [job_invocation.task_id]
      task_group.save!
      job_invocation.task_group_id = task_group.id
      job_invocation.save!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_remote_execution-0.1.2 db/migrate/20151217092555_migrate_to_task_groups.rb