diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-07-06 12:16:37 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-07-06 12:16:37 +0000 |
commit | b62825fd8e9c2215a270675a1209442fd1d38b30 (patch) | |
tree | 5b207dc4e9aaeabfadf3c6a7df56aa7feb600405 /app | |
parent | 34fe32740f475051dfcbb696f11c270ae327dc4a (diff) | |
parent | 98b1f5496ce47ea09e6cc57a503995e0ceadb254 (diff) | |
download | gitlab-ce-b62825fd8e9c2215a270675a1209442fd1d38b30.tar.gz |
Merge branch 'blackst0ne-rails5-activerecord-statementinvalid-mysql2-error-expression-1-of-select-list-is-not-in-group-by-clause' into 'master'
[Rails5] Fix milestone GROUP BY query
Closes #48428
See merge request gitlab-org/gitlab-ce!20256
Diffstat (limited to 'app')
-rw-r--r-- | app/models/milestone.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb index d05dcfd083a..14cc12b38a5 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -131,9 +131,10 @@ class Milestone < ActiveRecord::Base rel.order(:project_id, :due_date).select('DISTINCT ON (project_id) id') else rel - .group(:project_id) + .group(:project_id, :due_date, :id) .having('due_date = MIN(due_date)') .pluck(:id, :project_id, :due_date) + .uniq(&:second) .map(&:first) end end |