summaryrefslogtreecommitdiff
path: root/db/post_migrate/20170711145558_migrate_stages_statuses.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20170711145558_migrate_stages_statuses.rb')
-rw-r--r--db/post_migrate/20170711145558_migrate_stages_statuses.rb34
1 files changed, 0 insertions, 34 deletions
diff --git a/db/post_migrate/20170711145558_migrate_stages_statuses.rb b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
deleted file mode 100644
index 8ba69ea4dce..00000000000
--- a/db/post_migrate/20170711145558_migrate_stages_statuses.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-class MigrateStagesStatuses < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- BATCH_SIZE = 10000
- RANGE_SIZE = 100
- MIGRATION = 'MigrateStageStatus'.freeze
-
- class Stage < ActiveRecord::Base
- self.table_name = 'ci_stages'
- include ::EachBatch
- end
-
- def up
- Stage.where(status: nil).each_batch(of: BATCH_SIZE) do |relation, index|
- relation.each_batch(of: RANGE_SIZE) do |batch|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
- delay = index * 5.minutes
-
- BackgroundMigrationWorker.perform_in(delay, MIGRATION, range)
- end
- end
- end
-
- def down
- disable_statement_timeout do
- # rubocop:disable Migration/UpdateLargeTable
- update_column_in_batches(:ci_stages, :status, nil)
- end
- end
-end