From c56db8f2c4846ce5a23e08bc82def310041033a0 Mon Sep 17 00:00:00 2001 From: ᴜɴᴋɴᴡᴏɴ Date: Fri, 18 Sep 2020 18:37:47 +0800 Subject: db: create new session for MySQL after changing attribute (#6338) --- internal/db/db.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'internal') diff --git a/internal/db/db.go b/internal/db/db.go index ce130f2c..c3e3f19a 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -187,7 +187,10 @@ func Init() (*gorm.DB, error) { conf.UsePostgreSQL = true case "mysql": 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": conf.UseSQLite3 = true case "mssql": -- cgit v1.2.3