fix: try to fix pgsql #682

This commit is contained in:
CalciumIon
2024-12-31 02:06:30 +08:00
parent b4f17543cb
commit 87d5e286d5

View File

@@ -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://") {