From aafad0b8b050b8d1f73c7a68f9adbd1a14643f88 Mon Sep 17 00:00:00 2001 From: kicer Date: Thu, 3 Sep 2026 23:47:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(db):=20ALTER=20=E8=AF=AF=E5=A1=9E=E5=9C=A8?= =?UTF-8?q?=20db.exec=20=E6=A8=A1=E6=9D=BF=E4=B8=B2=E9=87=8C=20=E2=80=94?= =?UTF-8?q?=20=E6=8B=86=E5=87=BA=E6=9D=A5=E4=BD=9C=E7=8B=AC=E7=AB=8B=20JS?= =?UTF-8?q?=20=E8=AF=AD=E5=8F=A5,=E5=85=8D=E8=A2=AB=20SQLite=20=E8=AF=AF?= =?UTF-8?q?=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/db.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/server/db.js b/app/server/db.js index 9be42d1..9b81ada 100644 --- a/app/server/db.js +++ b/app/server/db.js @@ -36,8 +36,10 @@ function initDb(dbPath) { created_at INTEGER NOT NULL, FOREIGN KEY (session_id) REFERENCES sessions(id) ); - // 升级老库:早期表不带 reasoning 列,补上(重入安全) - try { db.exec('ALTER TABLE messages ADD COLUMN reasoning TEXT'); } catch (_) { /* 已存在 */ } + `); + // 升级老库:早期表不带 reasoning 列,补上(重入安全;不在上面 db.exec 模板串里,免得被当作 SQL 解析) + try { db.exec('ALTER TABLE messages ADD COLUMN reasoning TEXT'); } catch (_) { /* 已存在 */ } + db.exec(` CREATE TABLE IF NOT EXISTS files ( id INTEGER PRIMARY KEY AUTOINCREMENT,