-- Audit log table for memory-node M1b
CREATE TABLE IF NOT EXISTS audit_log (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  ts TEXT NOT NULL,
  project_id TEXT,
  user TEXT,
  action TEXT NOT NULL,
  entry_id TEXT,
  details TEXT,
  redacted INTEGER DEFAULT 0
);
-- Index for fast lookup by project and entry
CREATE INDEX IF NOT EXISTS idx_audit_log_project_id ON audit_log(project_id);
CREATE INDEX IF NOT EXISTS idx_audit_log_entry_id ON audit_log(entry_id);
