mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-18 00:16:37 +08:00
enable parseTime=true
This commit is contained in:
parent
e8bcf60f0a
commit
c09f3b9282
@ -54,8 +54,12 @@ func chooseDB() (*gorm.DB, error) {
|
|||||||
common.SysLog("using MySQL as database")
|
common.SysLog("using MySQL as database")
|
||||||
// check parseTime
|
// check parseTime
|
||||||
if !strings.Contains(dsn, "parseTime") {
|
if !strings.Contains(dsn, "parseTime") {
|
||||||
|
if strings.Contains(dsn, "?") {
|
||||||
|
dsn += "&parseTime=true"
|
||||||
|
} else {
|
||||||
dsn += "?parseTime=true"
|
dsn += "?parseTime=true"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return gorm.Open(mysql.Open(dsn), &gorm.Config{
|
return gorm.Open(mysql.Open(dsn), &gorm.Config{
|
||||||
PrepareStmt: true, // precompile SQL
|
PrepareStmt: true, // precompile SQL
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user