summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-20 13:37:59 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-20 13:37:59 +0100
commit2d027056f9c56ad733bcccf54c3b7cf8c7cb95bf (patch)
tree1db2041b8557c195b5d9f4c62bce8bbee28a191e /db
parentdfef5437a26320fc4a55fc857b6e59d5e92c13c3 (diff)
downloadgitlab-ce-2d027056f9c56ad733bcccf54c3b7cf8c7cb95bf.tar.gz
Add index before going through builds in a migration
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20180212101928_schedule_build_stage_migration.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
index df15b2cd9d4..f42a09f2223 100644
--- a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
+++ b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
@@ -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