Make stages index background migration more idempotent

This commit is contained in:
Grzegorz Bizon 2018-04-20 12:55:39 +02:00
parent 02999234d4
commit 181d8f687d

View file

@ -18,6 +18,7 @@ module Gitlab
WHERE ci_builds.stage_id = ci_stages.id
GROUP BY ci_builds.stage_idx ORDER BY COUNT(*) DESC LIMIT 1)
WHERE ci_stages.id BETWEEN #{start_id.to_i} AND #{stop_id.to_i}
AND ci_stages.index IS NULL
SQL
ActiveRecord::Base.connection.execute(sql)