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
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
......
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