2021-11-11 13:14:04 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class UpdateVulnerabilityOccurrencesLocation < Gitlab::Database::Migration[1.0]
|
|
|
|
BATCH_SIZE = 20_000
|
|
|
|
DELAY_INTERVAL = 3.minutes
|
|
|
|
MIGRATION_NAME = 'UpdateVulnerabilityOccurrencesLocation'
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
2021-11-11 19:10:48 -05:00
|
|
|
return unless Gitlab.ee?
|
|
|
|
|
2021-11-11 13:14:04 -05:00
|
|
|
relation = Gitlab::BackgroundMigration::UpdateVulnerabilityOccurrencesLocation::Occurrence.where(location: nil)
|
|
|
|
queue_background_migration_jobs_by_range_at_intervals(relation,
|
|
|
|
MIGRATION_NAME,
|
|
|
|
DELAY_INTERVAL,
|
|
|
|
batch_size: BATCH_SIZE,
|
|
|
|
track_jobs: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
# no-op
|
|
|
|
end
|
|
|
|
end
|