diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-01 15:30:44 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-01 15:30:44 +0300 |
commit | 0fd0b64be63c18bb216f15d887e3ce0955dcf269 (patch) | |
tree | f62cd1d970ba738ef0825f745c4c44714a6b126e /lib/gitlab/background_migration | |
parent | b337a086d5118e80518945abfc2e88008d9fc1ec (diff) |
Use stages position column to track stage index
Diffstat (limited to 'lib/gitlab/background_migration')
-rw-r--r-- | lib/gitlab/background_migration/migrate_stage_index.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/background_migration/migrate_stage_index.rb b/lib/gitlab/background_migration/migrate_stage_index.rb index 140c75054df..f90f35a913d 100644 --- a/lib/gitlab/background_migration/migrate_stage_index.rb +++ b/lib/gitlab/background_migration/migrate_stage_index.rb @@ -26,19 +26,19 @@ module Gitlab FROM freqs ) - UPDATE ci_stages SET priority = indexes.index + UPDATE ci_stages SET position = indexes.index FROM indexes WHERE indexes.stage_id = ci_stages.id - AND ci_stages.priority IS NULL; + AND ci_stages.position IS NULL; SQL else <<~SQL UPDATE ci_stages - SET priority = + SET position = (SELECT stage_idx FROM ci_builds 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} AND #{stop_id} - AND ci_stages.priority IS NULL + AND ci_stages.position IS NULL SQL end end |