Unveränderter Stand von certvia/dev (a48c5fb) plus Craftvia-Spezifikation und Brandbook unter docs/craftvia/. ISMS-Module werden im Folgecommit entfernt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
41 lines
1.4 KiB
SQL
41 lines
1.4 KiB
SQL
-- Backup/DSGVO-Lane: globale Modelle (kein tenant_id, kein RLS, analog Kataloge).
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "deletion_certificates" (
|
|
"id" TEXT NOT NULL,
|
|
"scope" TEXT NOT NULL,
|
|
"tenant_id" TEXT,
|
|
"tenant_slug" TEXT,
|
|
"subject_identity_id" TEXT,
|
|
"subject_email" TEXT,
|
|
"actor_id" TEXT,
|
|
"deleted_counts" JSONB NOT NULL DEFAULT '{}',
|
|
"anonymized_counts" JSONB NOT NULL DEFAULT '{}',
|
|
"snapshot_id" TEXT,
|
|
"reason" TEXT,
|
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "deletion_certificates_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "tombstone_entries" (
|
|
"id" TEXT NOT NULL,
|
|
"tenant_id" TEXT NOT NULL,
|
|
"model" TEXT NOT NULL,
|
|
"target_field" TEXT NOT NULL,
|
|
"target_value" TEXT NOT NULL,
|
|
"action" TEXT NOT NULL,
|
|
"anonymized_fields" JSONB NOT NULL DEFAULT '{}',
|
|
"reason" TEXT,
|
|
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "tombstone_entries_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "deletion_certificates_tenant_id_idx" ON "deletion_certificates"("tenant_id");
|
|
CREATE INDEX "deletion_certificates_subject_identity_id_idx" ON "deletion_certificates"("subject_identity_id");
|
|
CREATE INDEX "tombstone_entries_tenant_id_idx" ON "tombstone_entries"("tenant_id");
|
|
CREATE UNIQUE INDEX "tombstone_entries_tenant_id_model_target_value_key" ON "tombstone_entries"("tenant_id", "model", "target_value");
|