2018-04-20 09:20:43 +00:00
|
|
|
class ScheduleStagesIndexMigration < ActiveRecord::Migration
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
MIGRATION = 'MigrateStageIndex'.freeze
|
2018-04-24 09:52:50 +00:00
|
|
|
BATCH_SIZE = 8000
|
2018-04-20 09:20:43 +00:00
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
class Stage < ActiveRecord::Base
|
|
|
|
include EachBatch
|
|
|
|
self.table_name = 'ci_stages'
|
|
|
|
end
|
|
|
|
|
|
|
|
def up
|
|
|
|
disable_statement_timeout
|
|
|
|
|
|
|
|
Stage.all.tap do |relation|
|
|
|
|
queue_background_migration_jobs_by_range_at_intervals(relation,
|
|
|
|
MIGRATION,
|
|
|
|
5.minutes,
|
|
|
|
batch_size: BATCH_SIZE)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
# noop
|
|
|
|
end
|
|
|
|
end
|