HotTRDealsBackend/prisma/migrations/20260124031835_add_comment_delete/migration.sql
2026-01-25 17:50:56 +00:00

26 lines
885 B
SQL

/*
Warnings:
- Added the required column `updatedAt` to the `Comment` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Comment" ADD COLUMN "deletedAt" TIMESTAMP(3),
ADD COLUMN "parentId" INTEGER,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
-- CreateIndex
CREATE INDEX "Comment_dealId_createdAt_idx" ON "Comment"("dealId", "createdAt");
-- CreateIndex
CREATE INDEX "Comment_parentId_createdAt_idx" ON "Comment"("parentId", "createdAt");
-- CreateIndex
CREATE INDEX "Comment_dealId_parentId_createdAt_idx" ON "Comment"("dealId", "parentId", "createdAt");
-- CreateIndex
CREATE INDEX "Comment_deletedAt_idx" ON "Comment"("deletedAt");
-- AddForeignKey
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "Comment"("id") ON DELETE SET NULL ON UPDATE CASCADE;