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

backfill_vulnerability_reads_cluster_agent_batching_strategy.rb « batching_strategies « background_migration « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f0d015198dc9aa3b7f5e106a6d43edfb4c68d3c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    module BatchingStrategies
      # Batching class to use for back-filling vulnerability_read's casted_cluster_agent_id from cluster_agent_id.
      # Batches will be scoped to records where the report_type belongs to cluster_image_scanning.
      #
      # If no more batches exist in the table, returns nil.
      class BackfillVulnerabilityReadsClusterAgentBatchingStrategy < PrimaryKeyBatchingStrategy
        CLUSTER_IMAGE_SCANNING_REPORT_TYPE = 7

        def apply_additional_filters(relation, job_arguments: [], job_class: nil)
          relation.where(report_type: CLUSTER_IMAGE_SCANNING_REPORT_TYPE)
        end
      end
    end
  end
end