-- version: 14
-- Auth (SP-auth): record the acting user_id on every audit_log entry.
--
-- Backwards-compatible: existing rows get NULL user_id (they were
-- written by the pre-auth `system` actor). Going forward, the FastAPI
-- get_current_user dependency injects the id into every audit log call.

ALTER TABLE audit_log ADD COLUMN user_id INTEGER;

CREATE INDEX idx_audit_log_user_id ON audit_log(user_id);