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
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-06 14:26:19 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-06 14:26:19 +0300
commit5a31bbe86ca41b1461ed8bf5a663aa51c123f149 (patch)
tree963f1665451fa1b010260c3ad2db0f508bda22ca /db
parentcafb1bfea4dbc7b6aad47580e76d68b8075d177f (diff)
Make pipeline stages ref migration more readable
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170526185921_migrate_build_stage_reference.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/db/post_migrate/20170526185921_migrate_build_stage_reference.rb b/db/post_migrate/20170526185921_migrate_build_stage_reference.rb
index 3c30dfd6dde..aa50b72839d 100644
--- a/db/post_migrate/20170526185921_migrate_build_stage_reference.rb
+++ b/db/post_migrate/20170526185921_migrate_build_stage_reference.rb
@@ -6,9 +6,11 @@ class MigrateBuildStageReference < ActiveRecord::Migration
def up
disable_statement_timeout
- stage_id = Arel.sql('(SELECT id FROM ci_stages ' \
- 'WHERE ci_stages.pipeline_id = ci_builds.commit_id ' \
- 'AND ci_stages.name = ci_builds.stage)')
+ stage_id = Arel.sql(<<-SQL.strip_heredoc
+ (SELECT id FROM ci_stages
+ WHERE ci_stages.pipeline_id = ci_builds.commit_id
+ AND ci_stages.name = ci_builds.stage)
+ SQL
update_column_in_batches(:ci_builds, :stage_id, stage_id) do |table, query|
query.where(table[:stage_id].eq(nil))