Files
loki/drizzle/0028_control_audit_events.sql
T
Mao NakamotoandCursor b1c4a3eb74 fix(control): stabilize autopilot injection and fleet observability
Align stop-hook, beacon, and UI dispatch gates so autopilot respects per-project pause, choice wire format, and typing blocks; add control audit trail, Fleet Doctor, and updated cloud-local docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 02:28:06 +02:00

36 lines
1.0 KiB
SQL

CREATE TABLE IF NOT EXISTS control_audit_events (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
project_id uuid REFERENCES entities(id) ON DELETE SET NULL,
project_key text,
tab_name text,
event text NOT NULL,
source text NOT NULL,
action text NOT NULL,
decision_source text,
reason text,
status text,
health text,
blocker_count integer,
no_op_count integer,
queue_length integer,
mode text,
prompt_hash text,
prompt_preview text,
command_id uuid,
meta jsonb,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_control_audit_user_time
ON control_audit_events (user_id, created_at);
CREATE INDEX IF NOT EXISTS idx_control_audit_user_project_time
ON control_audit_events (user_id, project_key, created_at);
CREATE INDEX IF NOT EXISTS idx_control_audit_event_time
ON control_audit_events (event, created_at);
CREATE INDEX IF NOT EXISTS idx_control_audit_action_time
ON control_audit_events (action, created_at);