From 371514c5f6d3104b18ce9e3250eeea8e8966c7df Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Tue, 19 Nov 2024 13:49:12 +0700 Subject: [PATCH] chore: migration --- .../migration.sql | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 prisma/migrations/20241119064105_refactor_status_relation/migration.sql diff --git a/prisma/migrations/20241119064105_refactor_status_relation/migration.sql b/prisma/migrations/20241119064105_refactor_status_relation/migration.sql new file mode 100644 index 0000000..1acb3db --- /dev/null +++ b/prisma/migrations/20241119064105_refactor_status_relation/migration.sql @@ -0,0 +1,20 @@ +/* + Warnings: + + - You are about to drop the column `workStatus` on the `RequestWork` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "RequestWork" DROP COLUMN "workStatus"; + +-- CreateTable +CREATE TABLE "RequestWorkStepStatus" ( + "step" INTEGER NOT NULL, + "workStatus" "RequestWorkStatus" NOT NULL DEFAULT 'Pending', + "requestWorkId" TEXT NOT NULL, + + CONSTRAINT "RequestWorkStepStatus_pkey" PRIMARY KEY ("step","requestWorkId") +); + +-- AddForeignKey +ALTER TABLE "RequestWorkStepStatus" ADD CONSTRAINT "RequestWorkStepStatus_requestWorkId_fkey" FOREIGN KEY ("requestWorkId") REFERENCES "RequestWork"("id") ON DELETE RESTRICT ON UPDATE CASCADE;