From 87d5e286d5ee73e591e5b1ac8bb2b0a24559b9b3 Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Tue, 31 Dec 2024 02:06:30 +0800 Subject: [PATCH] fix: try to fix pgsql #682 --- model/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/model/main.go b/model/main.go index 5606176b..3c4b4f82 100644 --- a/model/main.go +++ b/model/main.go @@ -16,7 +16,7 @@ import ( var groupCol string var keyCol string -func init() { +func initCol() { if common.UsingPostgreSQL { groupCol = `"group"` keyCol = `"key"` @@ -55,6 +55,9 @@ func createRootAccountIfNeed() error { } func chooseDB(envName string) (*gorm.DB, error) { + defer func() { + initCol() + }() dsn := os.Getenv(envName) if dsn != "" { if strings.HasPrefix(dsn, "postgres://") {