-- Access log for customers' personal data (who viewed or exported it, and when). CREATE TABLE "DataAccessLog" ( "id" TEXT NOT NULL, "shopId" TEXT NOT NULL, "actor" TEXT NOT NULL, "action" TEXT NOT NULL, "target" TEXT, "at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT "DataAccessLog_pkey" PRIMARY KEY ("id") ); CREATE INDEX "DataAccessLog_shopId_at_idx" ON "DataAccessLog"("shopId", "at"); ALTER TABLE "DataAccessLog" ADD CONSTRAINT "DataAccessLog_shopId_fkey" FOREIGN KEY ("shopId") REFERENCES "Shop"("id") ON DELETE CASCADE ON UPDATE CASCADE;