jws-backend/prisma/migrations/20240611060055_change_relation/migration.sql
2024-06-11 13:01:20 +07:00

25 lines
1.1 KiB
SQL

/*
Warnings:
- You are about to drop the column `productGroupId` on the `Product` table. All the data in the column will be lost.
- Added the required column `productGroupId` to the `ProductType` table without a default value. This is not possible if the table is not empty.
- Added the required column `productId` to the `WorkProduct` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Product" DROP CONSTRAINT "Product_productGroupId_fkey";
-- AlterTable
ALTER TABLE "Product" DROP COLUMN "productGroupId";
-- AlterTable
ALTER TABLE "ProductType" ADD COLUMN "productGroupId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "WorkProduct" ADD COLUMN "productId" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "WorkProduct" ADD CONSTRAINT "WorkProduct_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ProductType" ADD CONSTRAINT "ProductType_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE;