-- 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");
