Add index before going through builds in a migration
This commit is contained in:
parent
dfef5437a2
commit
2d027056f9
|
@ -15,12 +15,17 @@ class ScheduleBuildStageMigration < ActiveRecord::Migration
|
|||
def up
|
||||
disable_statement_timeout
|
||||
|
||||
add_concurrent_index(:ci_builds, :stage_id, where: 'stage_id IS NULL',
|
||||
name: 'tmp_stage_id_partial_null_index')
|
||||
|
||||
Build.where('stage_id IS NULL').tap do |relation|
|
||||
queue_background_migration_jobs_by_range_at_intervals(relation,
|
||||
MIGRATION,
|
||||
5.minutes,
|
||||
batch_size: BATCH_SIZE)
|
||||
end
|
||||
|
||||
remove_concurrent_index_by_name(:ci_builds, 'tmp_stage_id_partial_null_index')
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
Loading…
Reference in New Issue