diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-05 14:21:49 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-05 14:21:49 +0300 |
commit | af72fa9c9c0af25cb7d8d349abd9dea4897aeea8 (patch) | |
tree | d153910048a60d6eee67ec918232a13b42a93831 /db/post_migrate/20170526185842_migrate_pipeline_stages.rb | |
parent | 5b718d482584ad95caf25e0405a4eedb2bdc372e (diff) |
Migrate pipeline stages only when not migrated already
Diffstat (limited to 'db/post_migrate/20170526185842_migrate_pipeline_stages.rb')
-rw-r--r-- | db/post_migrate/20170526185842_migrate_pipeline_stages.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/db/post_migrate/20170526185842_migrate_pipeline_stages.rb b/db/post_migrate/20170526185842_migrate_pipeline_stages.rb index 05e095f07cb..382791c4664 100644 --- a/db/post_migrate/20170526185842_migrate_pipeline_stages.rb +++ b/db/post_migrate/20170526185842_migrate_pipeline_stages.rb @@ -11,9 +11,9 @@ class MigratePipelineStages < ActiveRecord::Migration execute <<-SQL.strip_heredoc INSERT INTO ci_stages (project_id, pipeline_id, name) SELECT project_id, commit_id, stage FROM ci_builds - WHERE stage IS NOT NULL - GROUP BY project_id, commit_id, stage, stage_idx - ORDER BY stage_idx + WHERE stage IS NOT NULL AND stage_id IS NULL + GROUP BY project_id, commit_id, stage + ORDER BY MAX(stage_idx) SQL end |