summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-05-08 17:47:09 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-05-08 17:47:09 +0200
commitfc8221ce6cae99326a0a519daa0ca7abe27e2728 (patch)
tree99cd4e716506a3ad8727fd986c354086fb39800b
parent8624a4eddec214a4092c34202bfc0cc92e72eb19 (diff)
downloadgitlab-ce-fc8221ce6cae99326a0a519daa0ca7abe27e2728.tar.gz
Reduce scope of orphaned builds to be removed
-rw-r--r--db/migrate/20180420010016_add_pipeline_build_foreign_key.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb b/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb
index 7fcd3b20d5e..6fabe07bc9c 100644
--- a/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb
+++ b/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb
@@ -13,7 +13,7 @@ class AddPipelineBuildForeignKey < ActiveRecord::Migration
execute <<~SQL
DELETE FROM ci_builds WHERE NOT EXISTS
(SELECT true FROM ci_pipelines WHERE ci_pipelines.id = ci_builds.commit_id)
- AND commit_id IS NOT NULL
+ AND stage_id IS NULL
SQL
add_concurrent_foreign_key(:ci_builds, :ci_pipelines, column: :commit_id)