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

20220404194649_replace_work_item_type_backfill_next_batch_strategy.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1f2c0715f04798445c3ed1de23e2fe8678ce054c (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

class ReplaceWorkItemTypeBackfillNextBatchStrategy < Gitlab::Database::Migration[1.0]
  JOB_CLASS_NAME = 'BackfillWorkItemTypeIdForIssues'
  NEW_STRATEGY_CLASS = 'BackfillIssueWorkItemTypeBatchingStrategy'
  OLD_STRATEGY_CLASS = 'PrimaryKeyBatchingStrategy'

  class InlineBatchedMigration < ApplicationRecord
    self.table_name = :batched_background_migrations
  end

  def up
    InlineBatchedMigration.where(job_class_name: JOB_CLASS_NAME)
                          .update_all(batch_class_name: NEW_STRATEGY_CLASS)
  end

  def down
    InlineBatchedMigration.where(job_class_name: JOB_CLASS_NAME)
                          .update_all(batch_class_name: OLD_STRATEGY_CLASS)
  end
end