Commit 7bc24ec2 authored by Dylan Griffith's avatar Dylan Griffith

Extract constants in 20180430143705_backfill_runner_type_for_ci_runners_post_migrate

parent dc439a3b
......@@ -3,14 +3,17 @@ class BackfillRunnerTypeForCiRunnersPostMigrate < ActiveRecord::Migration
DOWNTIME = false
PROJECT_RUNNER_TYPE = 1
INSTANCE_RUNNER_TYPE = 3
disable_ddl_transaction!
def up
update_column_in_batches(:ci_runners, :runner_type, 1) do |table, query|
update_column_in_batches(:ci_runners, :runner_type, PROJECT_RUNNER_TYPE) do |table, query|
query.where(table[:is_shared].eq(true)).where(table[:runner_type].eq(nil))
end
update_column_in_batches(:ci_runners, :runner_type, 3) do |table, query|
update_column_in_batches(:ci_runners, :runner_type, INSTANCE_RUNNER_TYPE) do |table, query|
query.where(table[:is_shared].eq(false)).where(table[:runner_type].eq(nil))
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment