refactor(db,persistence): unify EventStore and WorkflowAlertStore onto core/db SQLite

This commit is contained in:
gitea committed 2026-09-30 00:26:49 +08:00
1 parent 5a0c277993
commit 3864f0ffd0
7 files changed
+228 -34

No files matched your search

+32
View File
@@ -184,6 +184,38 @@ export const migrations: DatabaseMigration[] = [
}
},
},
{
version: 3,
name: "003_events_and_workflow_alerts_tables",
up(db: Database): void {
db.run(`
CREATE TABLE IF NOT EXISTS observed_events (
scope_key TEXT NOT NULL,
id TEXT NOT NULL,
corp_id TEXT NOT NULL,
kind TEXT NOT NULL,
observed_at INTEGER NOT NULL,
PRIMARY KEY (scope_key, id)
);
`);
db.run("CREATE INDEX IF NOT EXISTS idx_observed_events_scope ON observed_events(scope_key, observed_at);");
db.run(`
CREATE TABLE IF NOT EXISTS workflow_error_alerts (
scope_key TEXT NOT NULL,
id TEXT NOT NULL,
pipeline_id TEXT NOT NULL,
platform_id TEXT NOT NULL,
pipeline_name TEXT,
error_count INTEGER NOT NULL,
state INTEGER NOT NULL DEFAULT 0,
observed_at INTEGER NOT NULL,
PRIMARY KEY (scope_key, id)
);
`);
db.run("CREATE INDEX IF NOT EXISTS idx_workflow_alerts_scope ON workflow_error_alerts(scope_key);");
},
},
];
function seedDefaultPreference(db: Database): void {