Files
breakpilot-compliance/backend-compliance/migrations/086_agent_scans.sql
T
Benjamin Admin e35db90232 feat: Phase 5 — DB persistence for scan results + Phase 10 in plan
- Migration 086: compliance_agent_scans table (findings, services, corrections)
- agent_history_routes.py: POST /scans (save), GET /scans (list), GET /scans/{id}
- Scan results survive page reloads and can be reviewed later
- Phase 10 (Playwright website scanner) added to product roadmap

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-29 15:17:51 +02:00

34 lines
1.4 KiB
SQL

-- Migration 086: Agent Scan Results persistence
-- Stores scan results so they survive page reloads and can be reviewed later
CREATE TABLE IF NOT EXISTS compliance_agent_scans (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL DEFAULT '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e',
user_id TEXT NOT NULL DEFAULT 'default',
url TEXT NOT NULL,
scan_type TEXT NOT NULL, -- 'quick', 'scan', 'consent_test'
analysis_mode TEXT NOT NULL DEFAULT 'post_launch', -- 'pre_launch', 'post_launch'
classification TEXT,
risk_level TEXT,
risk_score FLOAT DEFAULT 0,
escalation_level TEXT,
responsible_role TEXT,
services JSONB DEFAULT '[]',
findings JSONB DEFAULT '[]',
corrections JSONB DEFAULT '[]',
consent_test JSONB,
text_references JSONB DEFAULT '[]',
mandatory_checks JSONB DEFAULT '[]',
summary_html TEXT,
pages_scanned INT DEFAULT 0,
pages_list JSONB DEFAULT '[]',
email_sent BOOLEAN DEFAULT FALSE,
email_recipient TEXT,
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_agent_scans_tenant ON compliance_agent_scans(tenant_id);
CREATE INDEX IF NOT EXISTS idx_agent_scans_url ON compliance_agent_scans(url);
CREATE INDEX IF NOT EXISTS idx_agent_scans_created ON compliance_agent_scans(created_at DESC);
CREATE INDEX IF NOT EXISTS idx_agent_scans_type ON compliance_agent_scans(scan_type);