Sha256: 0df06f277669788f3101acdb1236714f894346fa747511294ea300a4fbe7c07a

Contents?: true

Size: 521 Bytes

Versions: 21

Compression:

Stored size: 521 Bytes

Contents

class MigrateToTaskGroups < ActiveRecord::Migration
  class FakeJobInvocation < ActiveRecord::Base
    self.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

21 entries across 21 versions & 1 rubygems

Version Path
foreman_remote_execution-1.3.7 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.3.6 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.4.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.3.5 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.3.4 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.3.3 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.3.2 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.3.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.3.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.2.2 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.2.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.2.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.1.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.1.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-1.0.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-0.3.2 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-0.3.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-0.3.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-0.2.3 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-0.2.2 db/migrate/20151217092555_migrate_to_task_groups.rb