diff options
author | Sean McGivern <sean@gitlab.com> | 2016-05-16 10:23:21 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-05-16 10:25:24 +0100 |
commit | e8058bd23100949607ac8c353f482067c0ecd25a (patch) | |
tree | cfba577faab5ca3e2a418609e2a8050592c7f1be /app | |
parent | 750b2ff0eec67926e737a40c7975cce2b58e27f7 (diff) | |
download | gitlab-ce-e8058bd23100949607ac8c353f482067c0ecd25a.tar.gz |
Return a relation with Postgres17227-upcoming-milestone-is-confusing-when-projects-have-different-milestones
Postgres only needs to select a single column, so that can used as a
sub-query where `Milestone.upcoming_ids_by_projects` is actually used in
`IssuableFinder`.
MySQL needs to select the `due_date` column because it's used in the
`HAVING` clause, so it has to return an array of IDs.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/milestone.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 6b01e48d7fc..fe9a281f366 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -71,7 +71,7 @@ class Milestone < ActiveRecord::Base rel = unscoped.of_projects(projects).active.where('due_date > ?', Time.now) if Gitlab::Database.postgresql? - rel.order(:project_id, :due_date).pluck('DISTINCT ON (project_id) id') + rel.order(:project_id, :due_date).select('DISTINCT ON (project_id) id') else rel. group(:project_id). |