Files
seminarhof-e2e-mrffmekh/db/sqlite/0010-fabric-audit.sql
2026-07-10 23:12:46 +02:00

29 lines
931 B
SQL

-- ============================================================
-- Fabric audit event sink — the table Pikku Fabric writes AuditEvent
-- records to. This is the framework-level event stream (distinct from any
-- domain-level row-change history). Columns mirror the AuditEvent shape
-- (camelCase → snake_case for the CamelCasePlugin kysely).
-- ============================================================
CREATE TABLE audit (
event_id TEXT PRIMARY KEY,
type TEXT NOT NULL,
source TEXT,
outcome TEXT,
occurred_at TEXT NOT NULL DEFAULT (datetime('now')),
function_id TEXT,
wire_type TEXT,
wire_id TEXT,
trace_id TEXT,
transaction_id TEXT,
query_id TEXT,
actor TEXT,
input TEXT,
metadata TEXT
);
CREATE INDEX idx_audit_type ON audit(type);
CREATE INDEX idx_audit_occurred ON audit(occurred_at);
CREATE INDEX idx_audit_function ON audit(function_id);
CREATE INDEX idx_audit_trace ON audit(trace_id);