summaryrefslogtreecommitdiff
path: root/app/models/milestone.rb
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2018-08-13 12:15:41 +0200
committerJan Provaznik <jprovaznik@gitlab.com>2018-08-13 13:01:52 +0200
commitad712ddb1dba4189c7553f45f22f891f164a2762 (patch)
treebeb06fe86834b7288c4f6640e600e96435e3c402 /app/models/milestone.rb
parent00c474ae4efd296138598d9fb6609322beb43da9 (diff)
downloadgitlab-ce-rails5-mysql-group-by.tar.gz
Disable ONLY_FULL_GROUP_BY mode for mysqlrails5-mysql-group-by
* disables ONLY_FULL_GROUP_BY option which is enabled by default in rails 5 * reverts 'uniq' workaround which was necessary only when this option was enabled
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r--app/models/milestone.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index cb1def1b422..52b8c9ed247 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -133,10 +133,9 @@ class Milestone < ActiveRecord::Base
rel.order(:project_id, :due_date).select('DISTINCT ON (project_id) id')
else
rel
- .group(:project_id, :due_date, :id)
+ .group(:project_id)
.having('due_date = MIN(due_date)')
.pluck(:id, :project_id, :due_date)
- .uniq(&:second)
.map(&:first)
end
end