Sha256: c51dcda4abaa620bd95bcfcf2172bb0dc621f69a90092f47f05dc366daf882cd

Contents?: true

Size: 530 Bytes

Versions: 19

Compression:

Stored size: 530 Bytes

Contents

class MigrateToTaskGroups < ActiveRecord::Migration[4.2]
  class FakeJobInvocation < ApplicationRecord
    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').find_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

19 entries across 19 versions & 1 rubygems

Version Path
foreman_remote_execution-14.1.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-14.1.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-14.0.2 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-14.0.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-13.2.6 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-14.0.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-13.2.5 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-13.2.4 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-13.2.3 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-13.2.2 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-12.0.7 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-13.2.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-13.2.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-13.0.0 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-12.0.5 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-12.0.4 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-12.0.1 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-12.0.2 db/migrate/20151217092555_migrate_to_task_groups.rb
foreman_remote_execution-12.0.0 db/migrate/20151217092555_migrate_to_task_groups.rb