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 36s
CI / test-python-backend-compliance (push) Successful in 31s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 18s
5-Phasen-Migration: Go consent-service Proxies durch native Python/FastAPI ersetzt. Phase 1 — DSR (Betroffenenrechte): 6 Tabellen, 30 Endpoints, Frontend-API umgestellt Phase 2 — E-Mail-Templates: 5 Tabellen, 20 Endpoints, neues Frontend, SDK_STEPS erweitert Phase 3 — Legal Documents Extension: User Consents, Audit Log, Cookie-Kategorien Phase 4 — Banner Consent: Device-Consents, Site-Configs, Kategorien, Vendors Phase 5 — Cleanup: DSR-Proxy aus main.py entfernt, Frontend-URLs aktualisiert 148 neue Tests (50 + 47 + 26 + 25), alle bestanden. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
99 lines
4.0 KiB
SQL
99 lines
4.0 KiB
SQL
-- =========================================================
|
|
-- Migration 029: Banner Consent — Device-basierte Cookie-Consents
|
|
-- Fuer Einbettung in Kunden-Websites (Consent-Banner SDK)
|
|
-- =========================================================
|
|
|
|
-- compliance_banner_consents: Anonyme Geraete-Consents
|
|
CREATE TABLE IF NOT EXISTS compliance_banner_consents (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
tenant_id UUID NOT NULL,
|
|
site_id TEXT NOT NULL,
|
|
device_fingerprint TEXT NOT NULL,
|
|
categories JSONB DEFAULT '[]',
|
|
vendors JSONB DEFAULT '[]',
|
|
ip_hash TEXT,
|
|
user_agent TEXT,
|
|
consent_string TEXT,
|
|
expires_at TIMESTAMPTZ,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_banner_consent_tenant ON compliance_banner_consents(tenant_id);
|
|
CREATE INDEX IF NOT EXISTS idx_banner_consent_site ON compliance_banner_consents(site_id);
|
|
CREATE INDEX IF NOT EXISTS idx_banner_consent_device ON compliance_banner_consents(device_fingerprint);
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_banner_consent_site_device ON compliance_banner_consents(site_id, device_fingerprint);
|
|
|
|
-- compliance_banner_consent_audit_log: Immutable Audit
|
|
CREATE TABLE IF NOT EXISTS compliance_banner_consent_audit_log (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
tenant_id UUID NOT NULL,
|
|
consent_id UUID,
|
|
action TEXT NOT NULL,
|
|
site_id TEXT NOT NULL,
|
|
device_fingerprint TEXT,
|
|
categories JSONB DEFAULT '[]',
|
|
ip_hash TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_banner_audit_tenant ON compliance_banner_consent_audit_log(tenant_id);
|
|
CREATE INDEX IF NOT EXISTS idx_banner_audit_site ON compliance_banner_consent_audit_log(site_id);
|
|
CREATE INDEX IF NOT EXISTS idx_banner_audit_created ON compliance_banner_consent_audit_log(created_at);
|
|
|
|
-- compliance_banner_site_configs: Site-Konfiguration (UI-Theme, DSB-Info)
|
|
CREATE TABLE IF NOT EXISTS compliance_banner_site_configs (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
tenant_id UUID NOT NULL,
|
|
site_id TEXT NOT NULL,
|
|
site_name TEXT,
|
|
site_url TEXT,
|
|
banner_title TEXT DEFAULT 'Cookie-Einstellungen',
|
|
banner_description TEXT DEFAULT 'Wir verwenden Cookies, um Ihnen die bestmoegliche Erfahrung zu bieten.',
|
|
privacy_url TEXT,
|
|
imprint_url TEXT,
|
|
dsb_name TEXT,
|
|
dsb_email TEXT,
|
|
theme JSONB DEFAULT '{}',
|
|
tcf_enabled BOOLEAN DEFAULT FALSE,
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_banner_site_config ON compliance_banner_site_configs(tenant_id, site_id);
|
|
|
|
-- compliance_banner_category_configs: Consent-Kategorien pro Site
|
|
CREATE TABLE IF NOT EXISTS compliance_banner_category_configs (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
site_config_id UUID NOT NULL REFERENCES compliance_banner_site_configs(id) ON DELETE CASCADE,
|
|
category_key TEXT NOT NULL,
|
|
name_de TEXT NOT NULL,
|
|
name_en TEXT,
|
|
description_de TEXT,
|
|
description_en TEXT,
|
|
is_required BOOLEAN NOT NULL DEFAULT FALSE,
|
|
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_banner_cat_config ON compliance_banner_category_configs(site_config_id);
|
|
|
|
-- compliance_banner_vendor_configs: Third-Party-Vendor-Tracking
|
|
CREATE TABLE IF NOT EXISTS compliance_banner_vendor_configs (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
site_config_id UUID NOT NULL REFERENCES compliance_banner_site_configs(id) ON DELETE CASCADE,
|
|
vendor_name TEXT NOT NULL,
|
|
vendor_url TEXT,
|
|
category_key TEXT NOT NULL,
|
|
description_de TEXT,
|
|
description_en TEXT,
|
|
cookie_names JSONB DEFAULT '[]',
|
|
retention_days INTEGER DEFAULT 365,
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_banner_vendor_config ON compliance_banner_vendor_configs(site_config_id);
|