2022-03-03 12:14:02 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ScheduleNullifyOrphanRunnerIdOnCiBuilds < Gitlab::Database::Migration[1.0]
|
2022-05-19 12:08:42 +00:00
|
|
|
disable_ddl_transaction!
|
|
|
|
|
2022-03-03 12:14:02 +00:00
|
|
|
MIGRATION = 'NullifyOrphanRunnerIdOnCiBuilds'
|
|
|
|
INTERVAL = 2.minutes
|
2022-03-17 18:08:54 +00:00
|
|
|
BATCH_SIZE = 50_000
|
|
|
|
MAX_BATCH_SIZE = 150_000
|
|
|
|
SUB_BATCH_SIZE = 500
|
2022-03-03 12:14:02 +00:00
|
|
|
|
|
|
|
def up
|
|
|
|
queue_batched_background_migration(
|
|
|
|
MIGRATION,
|
|
|
|
:ci_builds,
|
|
|
|
:id,
|
|
|
|
job_interval: INTERVAL,
|
|
|
|
batch_size: BATCH_SIZE,
|
|
|
|
max_batch_size: MAX_BATCH_SIZE,
|
|
|
|
sub_batch_size: SUB_BATCH_SIZE
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
2022-05-18 18:08:05 +00:00
|
|
|
delete_batched_background_migration(MIGRATION, :ci_builds, :id, [])
|
2022-03-03 12:14:02 +00:00
|
|
|
end
|
|
|
|
end
|