-- Preserve recipes if someone attempts a physical user delete by blocking the FK.
ALTER TABLE "Recipe" DROP CONSTRAINT "Recipe_userId_fkey";
ALTER TABLE "Recipe"
ADD CONSTRAINT "Recipe_userId_fkey"
FOREIGN KEY ("userId") REFERENCES "User"("id")
ON DELETE RESTRICT
ON UPDATE CASCADE;

-- Support soft delete / anonymization of user accounts.
ALTER TABLE "User"
ADD COLUMN "deletedAt" TIMESTAMP(3),
ADD COLUMN "anonymizedAt" TIMESTAMP(3);
