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

20230214122717_fix_partition_ids_for_ci_job_variables.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0a201c514674b50ae3df6490193c6546b74457f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class FixPartitionIdsForCiJobVariables < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!
  restrict_gitlab_migration gitlab_schema: :gitlab_ci

  BATCH_SIZE = 50

  def up
    return unless Gitlab.com?

    define_batchable_model(:ci_job_variables)
      .where(partition_id: 101)
      .each_batch(of: BATCH_SIZE) do |batch|
        batch.update_all(partition_id: 100)
        sleep 0.1
      end
  end

  def down
    # no-op
  end
end