feat: doc comments

This commit is contained in:
Catalin Pit
2024-01-11 11:53:52 +02:00
parent b09071ebc7
commit 13d23b6111
13 changed files with 262 additions and 79 deletions

View File

@ -0,0 +1,17 @@
-- CreateTable
CREATE TABLE "DocumentComment" (
"id" SERIAL NOT NULL,
"documentId" INTEGER NOT NULL,
"userId" INTEGER NOT NULL,
"comment" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "DocumentComment_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "DocumentComment" ADD CONSTRAINT "DocumentComment_documentId_fkey" FOREIGN KEY ("documentId") REFERENCES "Document"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DocumentComment" ADD CONSTRAINT "DocumentComment_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "DocumentComment" ADD COLUMN "parentId" INTEGER;
-- AddForeignKey
ALTER TABLE "DocumentComment" ADD CONSTRAINT "DocumentComment_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "DocumentComment"("id") ON DELETE CASCADE ON UPDATE CASCADE;