summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb')
-rw-r--r--db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb49
1 files changed, 0 insertions, 49 deletions
diff --git a/db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb b/db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb
deleted file mode 100644
index 1f6650140d4..00000000000
--- a/db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillCadenceIdForBoardsScopedToIteration < Gitlab::Database::Migration[1.0]
- disable_ddl_transaction!
-
- BATCH_SIZE = 1000
- DELAY = 2.minutes.to_i
- MIGRATION = 'BackfillIterationCadenceIdForBoards'
-
- class MigrationBoard < ApplicationRecord
- include EachBatch
-
- self.table_name = 'boards'
- end
-
- def up
- schedule_backfill_group_boards
- schedule_backfill_project_boards
- end
-
- def down
- MigrationBoard.where.not(iteration_cadence_id: nil).each_batch(of: BATCH_SIZE) do |batch, index|
- range = batch.pick(Arel.sql('MIN(id)'), Arel.sql('MAX(id)'))
- delay = index * DELAY
-
- migrate_in(delay, MIGRATION, ['none', 'down', *range])
- end
- end
-
- private
-
- def schedule_backfill_project_boards
- MigrationBoard.where(iteration_id: -4).where.not(project_id: nil).where(iteration_cadence_id: nil).each_batch(of: BATCH_SIZE) do |batch, index|
- range = batch.pick(Arel.sql('MIN(id)'), Arel.sql('MAX(id)'))
- delay = index * DELAY
-
- migrate_in(delay, MIGRATION, ['project', 'up', *range])
- end
- end
-
- def schedule_backfill_group_boards
- MigrationBoard.where(iteration_id: -4).where.not(group_id: nil).where(iteration_cadence_id: nil).each_batch(of: BATCH_SIZE) do |batch, index|
- range = batch.pick(Arel.sql('MIN(id)'), Arel.sql('MAX(id)'))
- delay = index * DELAY
-
- migrate_in(delay, MIGRATION, ['group', 'up', *range])
- end
- end
-end