Commit e0b73002 by CalciumIon

fix: try to fix pgsql #682

parent 2de4de00
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
var groupCol string var groupCol string
var keyCol string var keyCol string
func init() { func initCol() {
if common.UsingPostgreSQL { if common.UsingPostgreSQL {
groupCol = `"group"` groupCol = `"group"`
keyCol = `"key"` keyCol = `"key"`
...@@ -55,6 +55,9 @@ func createRootAccountIfNeed() error { ...@@ -55,6 +55,9 @@ func createRootAccountIfNeed() error {
} }
func chooseDB(envName string) (*gorm.DB, error) { func chooseDB(envName string) (*gorm.DB, error) {
defer func() {
initCol()
}()
dsn := os.Getenv(envName) dsn := os.Getenv(envName)
if dsn != "" { if dsn != "" {
if strings.HasPrefix(dsn, "postgres://") { if strings.HasPrefix(dsn, "postgres://") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment