From c56db8f2c4846ce5a23e08bc82def310041033a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=9C=C9=B4=E1=B4=8B=C9=B4=E1=B4=A1=E1=B4=8F=C9=B4?= Date: Fri, 18 Sep 2020 18:37:47 +0800 Subject: [PATCH] db: create new session for MySQL after changing attribute (#6338) --- internal/db/db.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/db/db.go b/internal/db/db.go index ce130f2cc..c3e3f19ad 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":