fix(db): ALTER 误塞在 db.exec 模板串里 — 拆出来作独立 JS 语句,免被 SQLite 误解析

This commit is contained in:
2026-09-03 23:47:17 +08:00
parent 39c46072fa
commit aafad0b8b0
+4 -2
View File
@@ -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,