Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/background_migration/drop_vulnerabilities_without_finding_id.rb')
-rw-r--r--lib/gitlab/background_migration/drop_vulnerabilities_without_finding_id.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/background_migration/drop_vulnerabilities_without_finding_id.rb b/lib/gitlab/background_migration/drop_vulnerabilities_without_finding_id.rb
new file mode 100644
index 00000000000..783bf0e2bda
--- /dev/null
+++ b/lib/gitlab/background_migration/drop_vulnerabilities_without_finding_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module BackgroundMigration
+ class DropVulnerabilitiesWithoutFindingId < BatchedMigrationJob
+ operation_name :drop_vulnerabilities_without_finding_id
+ scope_to ->(relation) { relation.where(finding_id: nil) }
+ feature_category :vulnerability_management
+
+ def perform
+ each_sub_batch(&:delete_all)
+ end
+ end
+ end
+end