Fixing MSSQL timestamp type (#5511)
MSSQL is using the wrong type here which results in a strconv.ParseInt: parsing "2018-12-07T00:00:00Z": invalid syntax error. The added datediff(SECOND, '19700101', x) results in the unix timestamp to be returned. Signed-off-by: Christopher Dziomba <christopher.dziomba@gmail.com>
This commit is contained in:
parent
205a533645
commit
64680b72bd
|
@ -28,7 +28,7 @@ func GetUserHeatmapDataByUser(user *User) ([]*UserHeatmapData, error) {
|
||||||
case setting.UsePostgreSQL:
|
case setting.UsePostgreSQL:
|
||||||
groupBy = "extract(epoch from date_trunc('day', to_timestamp(created_unix)))"
|
groupBy = "extract(epoch from date_trunc('day', to_timestamp(created_unix)))"
|
||||||
case setting.UseMSSQL:
|
case setting.UseMSSQL:
|
||||||
groupBy = "dateadd(DAY,0, datediff(day,0, dateadd(s, created_unix, '19700101')))"
|
groupBy = "datediff(SECOND, '19700101', dateadd(DAY, 0, datediff(day, 0, dateadd(s, created_unix, '19700101'))))"
|
||||||
groupByName = groupBy
|
groupByName = groupBy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue