Commit af72fa9c authored by Grzegorz Bizon's avatar Grzegorz Bizon

Migrate pipeline stages only when not migrated already

parent 5b718d48
...@@ -11,9 +11,9 @@ class MigratePipelineStages < ActiveRecord::Migration ...@@ -11,9 +11,9 @@ class MigratePipelineStages < ActiveRecord::Migration
execute <<-SQL.strip_heredoc execute <<-SQL.strip_heredoc
INSERT INTO ci_stages (project_id, pipeline_id, name) INSERT INTO ci_stages (project_id, pipeline_id, name)
SELECT project_id, commit_id, stage FROM ci_builds SELECT project_id, commit_id, stage FROM ci_builds
WHERE stage IS NOT NULL WHERE stage IS NOT NULL AND stage_id IS NULL
GROUP BY project_id, commit_id, stage, stage_idx GROUP BY project_id, commit_id, stage
ORDER BY stage_idx ORDER BY MAX(stage_idx)
SQL SQL
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment