summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-12-16 07:03:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-12-16 07:03:47 +0000
commit7386ec037e14659d91c925925eaca3866fc75a8a (patch)
tree95409f998cef4359496afc4a61878ed6ae1c90d8 /lib
parentfee009f04fbb9d5a6550e54634cb25393d69f919 (diff)
downloadredmine-7386ec037e14659d91c925925eaca3866fc75a8a.tar.gz
redmine-7386ec037e14659d91c925925eaca3866fc75a8a.zip
Implement date grouping for MySQL (#13803).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17745 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/database.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/redmine/database.rb b/lib/redmine/database.rb
index c18470a41..82df4b6a4 100644
--- a/lib/redmine/database.rb
+++ b/lib/redmine/database.rb
@@ -74,6 +74,14 @@ module Redmine
else
"#{column}::date"
end
+ elsif mysql?
+ if time_zone
+ user_identifier = ActiveSupport::TimeZone.find_tzinfo(time_zone.name).identifier
+ local_identifier = ActiveSupport::TimeZone.find_tzinfo(Time.zone.name).identifier
+ "CONVERT_TZ(DATE(#{column}),'#{local_identifier}', '#{user_identifier}')"
+ else
+ "DATE(#{column})"
+ end
end
end