mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-11-28 17:41:15 +00:00
20 lines
760 B
SQL
20 lines
760 B
SQL
-- CreateEnum
|
|
CREATE TYPE "NotificationType" AS ENUM ('WARNING', 'FRIEND');
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "Notifications" (
|
|
"id" TEXT NOT NULL,
|
|
"type" "NotificationType" NOT NULL,
|
|
"content" TEXT NOT NULL,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"fromUserId" TEXT NOT NULL,
|
|
"toUserId" TEXT NOT NULL,
|
|
|
|
CONSTRAINT "Notifications_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "Notifications" ADD CONSTRAINT "Notifications_fromUserId_fkey" FOREIGN KEY ("fromUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "Notifications" ADD CONSTRAINT "Notifications_toUserId_fkey" FOREIGN KEY ("toUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|