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

backfill_project_statistics_with_container_registry_size_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: 9ad119310f7cadc51443582bf0184e8b18a794d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    module BatchingStrategies
      # Batching class to use for back-filling project_statistic's container_registry_size.
      # Batches will be scoped to records where the project_ids are migrated
      #
      # If no more batches exist in the table, returns nil.
      class BackfillProjectStatisticsWithContainerRegistrySizeBatchingStrategy < PrimaryKeyBatchingStrategy
        MIGRATION_PHASE_1_ENDED_AT = Date.new(2022, 01, 23).freeze

        def apply_additional_filters(relation, job_arguments: [], job_class: nil)
          relation.where(created_at: MIGRATION_PHASE_1_ENDED_AT..).or(
            relation.where(migration_state: 'import_done')
          ).select(:project_id).distinct
        end
      end
    end
  end
end