mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-12-01 02:41:17 +00:00
21 lines
760 B
MySQL
21 lines
760 B
MySQL
|
-- 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;
|