Skip to content

Commit

Permalink
enable parseTime=true
Browse files Browse the repository at this point in the history
  • Loading branch information
Calcium-Ion committed Dec 27, 2023
1 parent e8bcf60 commit c09f3b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion model/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ func chooseDB() (*gorm.DB, error) {
common.SysLog("using MySQL as database")
// check parseTime
if !strings.Contains(dsn, "parseTime") {
dsn += "?parseTime=true"
if strings.Contains(dsn, "?") {
dsn += "&parseTime=true"
} else {
dsn += "?parseTime=true"
}
}
return gorm.Open(mysql.Open(dsn), &gorm.Config{
PrepareStmt: true, // precompile SQL
Expand Down

0 comments on commit c09f3b9

Please sign in to comment.