2018-11-13 07:27:31 +00:00
|
|
|
class BackfillRunnerTypeForCiRunnersPostMigrate < ActiveRecord::Migration[4.2]
|
2018-04-30 13:00:28 +00:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2018-05-03 16:02:38 +00:00
|
|
|
INSTANCE_RUNNER_TYPE = 1
|
|
|
|
PROJECT_RUNNER_TYPE = 3
|
2018-05-03 09:03:19 +00:00
|
|
|
|
2018-04-30 13:00:28 +00:00
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
2018-07-25 08:59:23 +00:00
|
|
|
# rubocop:disable Migration/UpdateColumnInBatches
|
2018-05-03 16:02:38 +00:00
|
|
|
update_column_in_batches(:ci_runners, :runner_type, INSTANCE_RUNNER_TYPE) do |table, query|
|
2018-04-30 13:00:28 +00:00
|
|
|
query.where(table[:is_shared].eq(true)).where(table[:runner_type].eq(nil))
|
|
|
|
end
|
|
|
|
|
2018-05-03 16:02:38 +00:00
|
|
|
update_column_in_batches(:ci_runners, :runner_type, PROJECT_RUNNER_TYPE) do |table, query|
|
2018-04-30 13:00:28 +00:00
|
|
|
query.where(table[:is_shared].eq(false)).where(table[:runner_type].eq(nil))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
end
|
|
|
|
end
|