2019-02-15 15:39:39 +05:30
|
|
|
class ScheduleStagesIndexMigration < ActiveRecord::Migration[4.2]
|
2018-10-15 14:42:47 +05:30
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
MIGRATION = 'MigrateStageIndex'.freeze
|
|
|
|
BATCH_SIZE = 10000
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
class Stage < ActiveRecord::Base
|
|
|
|
include EachBatch
|
|
|
|
self.table_name = 'ci_stages'
|
|
|
|
end
|
|
|
|
|
|
|
|
def up
|
2018-11-20 20:47:30 +05:30
|
|
|
disable_statement_timeout do
|
|
|
|
Stage.all.tap do |relation|
|
|
|
|
queue_background_migration_jobs_by_range_at_intervals(relation,
|
|
|
|
MIGRATION,
|
|
|
|
5.minutes,
|
|
|
|
batch_size: BATCH_SIZE)
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
# noop
|
|
|
|
end
|
|
|
|
end
|