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

rebalance_partition_id.rb « background_migration « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7000ae5a8566aae9d18c3a6f0d568960590c7623 (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
    # This rebalances partition_id to fix invalid records in production
    class RebalancePartitionId < BatchedMigrationJob
      INVALID_PARTITION_ID = 101
      VALID_PARTITION_ID = 100

      scope_to ->(relation) { relation.where(partition_id: INVALID_PARTITION_ID) }
      operation_name :update_all
      feature_category :continuous_integration

      def perform
        each_sub_batch do |sub_batch|
          sub_batch.update_all(partition_id: VALID_PARTITION_ID)
        end
      end
    end
  end
end