summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2019-04-08 20:11:46 +0000
committerMichael Kozono <mkozono@gmail.com>2019-04-08 20:11:46 +0000
commitb22a725a0c8c122515a16beff50a008b46c4462a (patch)
treefdaa9df353506329494f249794f721a65352f298 /lib
parentb0854042923e9e8ad6b3f34b29631ffaa127d06e (diff)
parent0f5b735685476ff51b26031e9b74fa8256354868 (diff)
downloadgitlab-ce-b22a725a0c8c122515a16beff50a008b46c4462a.tar.gz
Merge branch 'sh-fix-issue-59985' into 'master'
Fix stage index migration failing in PostgreSQL 10 Closes #59985 See merge request gitlab-org/gitlab-ce!26972
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/background_migration/migrate_stage_index.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/background_migration/migrate_stage_index.rb b/lib/gitlab/background_migration/migrate_stage_index.rb
index f90f35a913d..f921233460d 100644
--- a/lib/gitlab/background_migration/migrate_stage_index.rb
+++ b/lib/gitlab/background_migration/migrate_stage_index.rb
@@ -21,8 +21,8 @@ module Gitlab
AND stage_idx IS NOT NULL
GROUP BY stage_id, stage_idx
), indexes AS (
- SELECT DISTINCT stage_id, last_value(stage_idx)
- OVER (PARTITION BY stage_id ORDER BY freq ASC) AS index
+ SELECT DISTINCT stage_id, first_value(stage_idx)
+ OVER (PARTITION BY stage_id ORDER BY freq DESC) AS index
FROM freqs
)