diff options
Diffstat (limited to 'db/post_migrate/20220404194649_replace_work_item_type_backfill_next_batch_strategy.rb')
-rw-r--r-- | db/post_migrate/20220404194649_replace_work_item_type_backfill_next_batch_strategy.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20220404194649_replace_work_item_type_backfill_next_batch_strategy.rb b/db/post_migrate/20220404194649_replace_work_item_type_backfill_next_batch_strategy.rb new file mode 100644 index 00000000000..1f2c0715f04 --- /dev/null +++ b/db/post_migrate/20220404194649_replace_work_item_type_backfill_next_batch_strategy.rb @@ -0,0 +1,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 |