2019-01-03 12:48:30 +05:30
|
|
|
class BackfillRunnerTypeForCiRunnersPostMigrate < ActiveRecord::Migration
|
2018-10-15 14:42:47 +05:30
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
INSTANCE_RUNNER_TYPE = 1
|
|
|
|
PROJECT_RUNNER_TYPE = 3
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
2018-11-18 11:00:15 +05:30
|
|
|
# rubocop:disable Migration/UpdateColumnInBatches
|
2018-10-15 14:42:47 +05:30
|
|
|
update_column_in_batches(:ci_runners, :runner_type, INSTANCE_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, PROJECT_RUNNER_TYPE) do |table, query|
|
|
|
|
query.where(table[:is_shared].eq(false)).where(table[:runner_type].eq(nil))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
end
|
|
|
|
end
|