From b3c721ee585e13a9699511d32c1da7a98d1ac559 Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Wed, 11 Mar 2026 11:33:21 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20schema=5Fcompat=20=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E8=A1=A8=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=20columnPatch=20=E5=AF=B9=E7=BC=BA=E5=A4=B1=E8=A1=A8?= =?UTF-8?q?=20panic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: claude-flow --- etc/ppanel.yaml | 4 ++-- initialize/schema_compat.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/etc/ppanel.yaml b/etc/ppanel.yaml index 8df77b4..15098be 100644 --- a/etc/ppanel.yaml +++ b/etc/ppanel.yaml @@ -15,9 +15,9 @@ Logger: # 日志配置 Level: debug # 日志级别: debug, info, warn, error, panic, fatal MySQL: - Addr: 127.0.0.1:3306 # host 网络模式; bridge 模式改为 mysql:3306 + Addr: 154.12.35.103:3306 # host 网络模式; bridge 模式改为 mysql:3306 Username: root # MySQL用户名 - Password: CHANGE_ME_MYSQL_PASSWORD # MySQL密码,与 .env MYSQL_ROOT_PASSWORD 一致 + Password: jpcV41ppanel # MySQL密码,与 .env MYSQL_ROOT_PASSWORD 一致 Dbname: ppanel # MySQL数据库名 Config: charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai MaxIdleConns: 10 diff --git a/initialize/schema_compat.go b/initialize/schema_compat.go index 329b0d1..10bf38d 100644 --- a/initialize/schema_compat.go +++ b/initialize/schema_compat.go @@ -138,6 +138,14 @@ func EnsureSchemaCompatibility(ctx *svc.ServiceContext) error { } for _, patch := range columnPatches { + tblExists, err := tableExists(ctx.DB, patch.table) + if err != nil { + return errors.Wrapf(err, "check table %s failed", patch.table) + } + if !tblExists { + logger.Infof("[SchemaCompat] skipping column patch %s.%s: table does not exist", patch.table, patch.column) + continue + } exists, err := columnExists(ctx.DB, patch.table, patch.column) if err != nil { return errors.Wrapf(err, "check column %s.%s failed", patch.table, patch.column)