035315ef73
Adds IiosRetentionPolicySnapshot (per-interaction frozen lifecycle timestamps) + IiosInteraction.dataClass, and a RetentionService whose sweep captures snapshots then archives (status change) and, past delete_after, redacts content in place (reusing the Slice-8 tombstone) — never a hard delete. An active compliance hold blocks both; every action is audited and tenant-scopeable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
1.1 KiB
SQL
30 lines
1.1 KiB
SQL
-- AlterTable
|
|
ALTER TABLE "IiosInteraction" ADD COLUMN "dataClass" TEXT NOT NULL DEFAULT 'internal';
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "IiosRetentionPolicySnapshot" (
|
|
"id" TEXT NOT NULL,
|
|
"policyKey" TEXT NOT NULL,
|
|
"scopeSnapshotId" TEXT NOT NULL,
|
|
"targetType" TEXT NOT NULL,
|
|
"targetId" TEXT NOT NULL,
|
|
"dataClass" TEXT NOT NULL,
|
|
"retainUntil" TIMESTAMP(3),
|
|
"archiveAfter" TIMESTAMP(3) NOT NULL,
|
|
"deleteAfter" TIMESTAMP(3) NOT NULL,
|
|
"sourceVersion" TEXT NOT NULL DEFAULT 'v1',
|
|
"status" TEXT NOT NULL DEFAULT 'ACTIVE',
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "IiosRetentionPolicySnapshot_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "IiosRetentionPolicySnapshot_status_deleteAfter_idx" ON "IiosRetentionPolicySnapshot"("status", "deleteAfter");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "IiosRetentionPolicySnapshot_scopeSnapshotId_status_idx" ON "IiosRetentionPolicySnapshot"("scopeSnapshotId", "status");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "IiosRetentionPolicySnapshot_targetType_targetId_key" ON "IiosRetentionPolicySnapshot"("targetType", "targetId");
|