summaryrefslogtreecommitdiff
path: root/lib/gitlab/background_migration/delete_orphans_approval_project_rules.rb
blob: 28809df8694620b9e8cc3899b10de39cfb085ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    # Deletes orphans records whenever report_type equals to scan_finding (i.e., 4)
    class DeleteOrphansApprovalProjectRules < BatchedMigrationJob
      operation_name :delete_all
      feature_category :database

      def perform
        each_sub_batch do |sub_batch|
          sub_batch.where(report_type: 4, security_orchestration_policy_configuration_id: nil).delete_all
        end
      end
    end
  end
end