diff --git a/electron/services/database.service.ts b/electron/services/database.service.ts index a507538..a14fe06 100644 --- a/electron/services/database.service.ts +++ b/electron/services/database.service.ts @@ -121,6 +121,7 @@ export class DatabaseService { CREATE TABLE IF NOT EXISTS audit_logs ( id INTEGER PRIMARY KEY AUTOINCREMENT, session_id TEXT, + iteration INTEGER, event_type TEXT NOT NULL, actor TEXT NOT NULL DEFAULT 'system', target TEXT NOT NULL, @@ -229,6 +230,14 @@ export class DatabaseService { } catch { // 列已存在,忽略 } + + // 迁移 2: audit_logs 表添加 iteration 列 + try { + db.exec('ALTER TABLE audit_logs ADD COLUMN iteration INTEGER'); + log.info('[DB] Migration: added iteration column to audit_logs'); + } catch { + // 列已存在,忽略 + } } /**