enable parseTime=true

This commit is contained in:
CaIon 2023-12-27 16:47:32 +08:00
parent e8bcf60f0a
commit c09f3b9282

View File

@ -54,8 +54,12 @@ func chooseDB() (*gorm.DB, error) {
common.SysLog("using MySQL as database")
// check parseTime
if !strings.Contains(dsn, "parseTime") {
if strings.Contains(dsn, "?") {
dsn += "&parseTime=true"
} else {
dsn += "?parseTime=true"
}
}
return gorm.Open(mysql.Open(dsn), &gorm.Config{
PrepareStmt: true, // precompile SQL
})