From c497b237cd0966acebca02ce70f39415d429ee13 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 15 Jul 2024 14:41:18 +0000 Subject: [PATCH] add migrate --- .../20240715144055_add_parent_code/migration.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 prisma/migrations/20240715144055_add_parent_code/migration.sql diff --git a/prisma/migrations/20240715144055_add_parent_code/migration.sql b/prisma/migrations/20240715144055_add_parent_code/migration.sql new file mode 100644 index 0000000..f698bc3 --- /dev/null +++ b/prisma/migrations/20240715144055_add_parent_code/migration.sql @@ -0,0 +1,15 @@ +-- CreateTable +CREATE TABLE "ActiveParentLoginCode" ( + "id" TEXT NOT NULL, + "parent_id" TEXT NOT NULL, + "code" INTEGER NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "ActiveParentLoginCode_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "ActiveParentLoginCode_code_key" ON "ActiveParentLoginCode"("code"); + +-- AddForeignKey +ALTER TABLE "ActiveParentLoginCode" ADD CONSTRAINT "ActiveParentLoginCode_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;