From aac4ff2d871bbc3769947bda3466438e8d7daa4c Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Wed, 8 Dec 2021 12:57:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=9A=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E9=80=82=E9=85=8D=E4=BD=8E=E7=89=88=E6=9C=AC=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/initialize/db_list.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/initialize/db_list.go b/server/initialize/db_list.go index 395d2834..5b20456e 100644 --- a/server/initialize/db_list.go +++ b/server/initialize/db_list.go @@ -5,6 +5,8 @@ import ( "gorm.io/gorm" ) +const system = "system" + func DBList() { dbMap := make(map[string]*gorm.DB) for _, info := range global.GVA_CONFIG.DBList { @@ -20,5 +22,10 @@ func DBList() { continue } } + // 做特殊判断,是否有迁移 + // 适配低版本迁移多数据库版本 + if sysDB, ok := dbMap[system]; ok { + global.GVA_DB = sysDB + } global.GVA_DBList = dbMap }