diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-12-12 19:52:28 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-12-12 19:52:28 +0000 |
commit | e647e99b741ce0360ee479925009076f48d0d8a5 (patch) | |
tree | e4f9bf27a97cbae1842e7e3448c3055cfe5dad48 /lib/redmine/database.rb | |
parent | 72980f41751a4d09c965733638572f799146e3e3 (diff) | |
download | redmine-e647e99b741ce0360ee479925009076f48d0d8a5.tar.gz redmine-e647e99b741ce0360ee479925009076f48d0d8a5.zip |
Allow issues grouping by creation, update and closing date (#13803).
Implemented for PostgreSQL only for now.
git-svn-id: http://svn.redmine.org/redmine/trunk@17724 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/database.rb')
-rw-r--r-- | lib/redmine/database.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/redmine/database.rb b/lib/redmine/database.rb index 02580d160..c18470a41 100644 --- a/lib/redmine/database.rb +++ b/lib/redmine/database.rb @@ -64,6 +64,19 @@ module Redmine end end + # Returns a SQL statement to cast a timestamp column to a date given a time zone + # Returns nil if not implemented for the current database + def timestamp_to_date(column, time_zone) + if postgresql? + if time_zone + identifier = ActiveSupport::TimeZone.find_tzinfo(time_zone.name).identifier + "(#{column}::timestamptz AT TIME ZONE '#{identifier}')::date" + else + "#{column}::date" + end + end + end + # Resets database information def reset @postgresql_unaccent = nil |