fix: audit_logs 表缺少 iteration 列导致写入失败
- CREATE TABLE 加入 iteration INTEGER - 新增迁移 ALTER TABLE audit_logs ADD COLUMN iteration
This commit is contained in:
@@ -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 {
|
||||
// 列已存在,忽略
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user