db: create new session for MySQL after changing attribute ()

pull/6340/head
ᴜɴᴋɴᴡᴏɴ 2020-09-18 18:37:47 +08:00 committed by GitHub
parent dda1092e74
commit c56db8f2c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions
internal/db

View File

@ -187,7 +187,10 @@ func Init() (*gorm.DB, error) {
conf.UsePostgreSQL = true conf.UsePostgreSQL = true
case "mysql": case "mysql":
conf.UseMySQL = true conf.UseMySQL = true
db = db.Set("gorm:table_options", "ENGINE=InnoDB") db = db.Set("gorm:table_options", "ENGINE=InnoDB").
Session(&gorm.Session{
WithConditions: true,
})
case "sqlite3": case "sqlite3":
conf.UseSQLite3 = true conf.UseSQLite3 = true
case "mssql": case "mssql":