Files
breakpilot-compliance/backend-compliance/migrations/003_document_import.sql
Benjamin Admin e6d666b89b
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 37s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 18s
feat: Vorbereitung-Module auf 100% — Persistenz, Backend-Services, UCCA Frontend
Phase A: PostgreSQL State Store (sdk_states Tabelle, InMemory-Fallback)
Phase B: Modules dynamisch vom Backend, Scope DB-Persistenz, Source Policy State
Phase C: UCCA Frontend (3 Seiten, Wizard, RiskScoreGauge), Obligations Live-Daten
Phase D: Document Import (PDF/LLM/Gap-Analyse), System Screening (SBOM/OSV.dev)
Phase E: Company Profile CRUD mit Audit-Logging
Phase F: Tests (Python + TypeScript), flow-data.ts DB-Tabellen aktualisiert

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 11:04:31 +01:00

42 lines
1.7 KiB
SQL

-- =============================================================================
-- Migration 003: Document Import Tables
--
-- Tables for imported compliance documents and gap analysis results.
-- =============================================================================
CREATE TABLE IF NOT EXISTS compliance_imported_documents (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(255) NOT NULL,
filename VARCHAR(500) NOT NULL,
file_type VARCHAR(50) NOT NULL,
file_size INTEGER,
detected_type VARCHAR(50),
detection_confidence FLOAT,
extracted_text TEXT,
extracted_entities JSONB DEFAULT '[]',
recommendations JSONB DEFAULT '[]',
status VARCHAR(20) DEFAULT 'pending',
analyzed_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_imported_docs_tenant ON compliance_imported_documents(tenant_id);
CREATE INDEX IF NOT EXISTS idx_imported_docs_status ON compliance_imported_documents(status);
CREATE TABLE IF NOT EXISTS compliance_gap_analyses (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(255) NOT NULL,
document_id UUID REFERENCES compliance_imported_documents(id) ON DELETE CASCADE,
total_gaps INTEGER DEFAULT 0,
critical_gaps INTEGER DEFAULT 0,
high_gaps INTEGER DEFAULT 0,
medium_gaps INTEGER DEFAULT 0,
low_gaps INTEGER DEFAULT 0,
gaps JSONB DEFAULT '[]',
recommended_packages JSONB DEFAULT '[]',
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_gap_analyses_tenant ON compliance_gap_analyses(tenant_id);
CREATE INDEX IF NOT EXISTS idx_gap_analyses_document ON compliance_gap_analyses(document_id);