From dd8d406c332277a69e15048a6cc35e3063ee2b92 Mon Sep 17 00:00:00 2001 From: black1552 Date: Tue, 3 Feb 2026 14:32:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(database):=20=E8=A7=A3=E5=86=B3SQLite?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=88=9D=E5=A7=8B=E5=8C=96=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加数据库文件创建逻辑确保文件存在 - 添加错误处理记录数据库创建失败日志 - 优化数据库初始化流程提高稳定性 --- database/database.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/database/database.go b/database/database.go index f481746..a56337c 100644 --- a/database/database.go +++ b/database/database.go @@ -67,5 +67,10 @@ func mysqlInit() { } func sqliteInit() { + _, err = gfile.Create(dns.String()) + if err != nil { + log.Error("创建数据库文件失败: ", err) + return + } Type = sqlite.Open(dns.String()) }