add interactions to comments
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Do-raa
2024-12-23 15:44:36 +01:00
parent 6d6d70295d
commit e24b3e1955
22 changed files with 3963 additions and 3410 deletions

View File

@@ -0,0 +1,24 @@
/*
Warnings:
- You are about to drop the column `comments` on the `Article` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Article" DROP COLUMN "comments";
-- CreateTable
CREATE TABLE "Comment" (
"id" TEXT NOT NULL,
"content" TEXT NOT NULL,
"likes" INTEGER NOT NULL DEFAULT 0,
"dislikes" INTEGER NOT NULL DEFAULT 0,
"articleId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Comment_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_articleId_fkey" FOREIGN KEY ("articleId") REFERENCES "Article"("id") ON DELETE RESTRICT ON UPDATE CASCADE;