[Rails5] Fix milestone GROUP BY query
This commit is contained in:
parent
d810e65a18
commit
98b1f5496c
|
@ -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
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: "[Rails5] Fix milestone GROUP BY query"
|
||||
merge_request: 20256
|
||||
author: "@blackst0ne"
|
||||
type: fixed
|
Loading…
Reference in New Issue