Class: Gitlab::BackgroundMigration::DropInvalidVulnerabilities

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/drop_invalid_vulnerabilities.rb

Overview

rubocop: disable Style/Documentation

Defined Under Namespace

Classes: VulnerabilitiesFinding, Vulnerability

Instance Method Summary collapse

Instance Method Details

#perform(start_id, end_id) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord


18
19
20
21
22
23
24
25
26
# File 'lib/gitlab/background_migration/drop_invalid_vulnerabilities.rb', line 18

def perform(start_id, end_id)
  Vulnerability
    .where(id: start_id..end_id)
    .left_joins(:findings)
    .where(vulnerability_occurrences: { vulnerability_id: nil })
    .delete_all

  mark_job_as_succeeded(start_id, end_id)
end