summaryrefslogtreecommitdiffstats
path: root/models/user_heatmap.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-24 17:24:45 +0800
committerAntoine GIRARD <sapk@users.noreply.github.com>2019-08-24 11:24:45 +0200
commitf83db078f0603c775cd1b1bb016f996b65a04835 (patch)
tree9895f852c768d43b384ba36259b44d9506b04093 /models/user_heatmap.go
parent26af3401c36e6316b81b92bf6a776bf2442d251c (diff)
downloadgitea-f83db078f0603c775cd1b1bb016f996b65a04835.tar.gz
gitea-f83db078f0603c775cd1b1bb016f996b65a04835.zip
Move database settings from models to setting (#7806)
* move database settings from models to setting * update docs * fix checkout pr * fix tests * fix lint * remove unsupported tidb options * correct wrong variable name * remove tidb totally
Diffstat (limited to 'models/user_heatmap.go')
-rw-r--r--models/user_heatmap.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/models/user_heatmap.go b/models/user_heatmap.go
index b511b5fa62..3d9e0683fc 100644
--- a/models/user_heatmap.go
+++ b/models/user_heatmap.go
@@ -21,13 +21,13 @@ func GetUserHeatmapDataByUser(user *User) ([]*UserHeatmapData, error) {
var groupBy string
var groupByName = "timestamp" // We need this extra case because mssql doesn't allow grouping by alias
switch {
- case setting.UseSQLite3:
+ case setting.Database.UseSQLite3:
groupBy = "strftime('%s', strftime('%Y-%m-%d', created_unix, 'unixepoch'))"
- case setting.UseMySQL:
+ case setting.Database.UseMySQL:
groupBy = "UNIX_TIMESTAMP(DATE(FROM_UNIXTIME(created_unix)))"
- case setting.UsePostgreSQL:
+ case setting.Database.UsePostgreSQL:
groupBy = "extract(epoch from date_trunc('day', to_timestamp(created_unix)))"
- case setting.UseMSSQL:
+ case setting.Database.UseMSSQL:
groupBy = "datediff(SECOND, '19700101', dateadd(DAY, 0, datediff(day, 0, dateadd(s, created_unix, '19700101'))))"
groupByName = groupBy
}