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;