19 lines
551 B
Ruby
19 lines
551 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
module BackgroundMigration
|
|
# Change the vulnerability state to `dismissed` if `dismissed_at` field is not null
|
|
class SetCorrectVulnerabilityState < BatchedMigrationJob
|
|
DISMISSED_STATE = 2
|
|
|
|
def perform
|
|
each_sub_batch(
|
|
operation_name: :update_vulnerabilities_state,
|
|
batching_scope: -> (relation) { relation.where.not(dismissed_at: nil) }
|
|
) do |sub_batch|
|
|
sub_batch.update_all(state: DISMISSED_STATE)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|