13 lines
583 B
SQL
13 lines
583 B
SQL
CREATE TABLE IF NOT EXISTS audit_events (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
event_type TEXT NOT NULL,
|
|
allocation_id INTEGER NULL REFERENCES allocations(id),
|
|
pool_id INTEGER NULL REFERENCES pools(id),
|
|
actor TEXT NOT NULL DEFAULT 'local',
|
|
details_json TEXT NOT NULL,
|
|
created_at TEXT NOT NULL
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_audit_events_allocation_id ON audit_events(allocation_id);
|
|
CREATE INDEX IF NOT EXISTS idx_audit_events_pool_id ON audit_events(pool_id);
|
|
CREATE INDEX IF NOT EXISTS idx_audit_events_created_at ON audit_events(created_at DESC);
|