Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-07 16:50:33 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-07 16:50:33 +0300
commit320229e12aea3c5f52bcf0fb413bb35138ef7c25 (patch)
tree65aae897f4877115c077fd3c6716dc916f0425ed /db/post_migrate
parentc467451ea6f39f498b458e11b5f8a74c53d3541d (diff)
Do not schedule bg migration when it is not needed
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb b/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
index 5b1ff9b8849..f31015d77a3 100644
--- a/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
+++ b/db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
@@ -17,7 +17,7 @@ class MigrateStageIdReferenceInBackground < ActiveRecord::Migration
# It will take around 3 days to process 20M ci_builds.
#
def up
- Build.all.each_batch(of: BATCH_SIZE) do |relation, index|
+ Build.where(stage_id: nil).each_batch(of: BATCH_SIZE) do |relation, index|
relation.each_batch(of: RANGE_SIZE) do |relation|
range = relation.pluck('MIN(id)', 'MAX(id)').first