refactor!: remove product type

This commit is contained in:
Methapon Metanipat 2024-09-03 14:06:02 +07:00
parent 4f84330cbc
commit 4b08d12845
7 changed files with 105 additions and 344 deletions

View file

@ -0,0 +1,41 @@
/*
Warnings:
- You are about to drop the column `productTypeId` on the `Product` table. All the data in the column will be lost.
- You are about to drop the column `productTypeId` on the `Service` table. All the data in the column will be lost.
- You are about to drop the `ProductType` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "Product" DROP CONSTRAINT "Product_productTypeId_fkey";
-- DropForeignKey
ALTER TABLE "ProductType" DROP CONSTRAINT "ProductType_createdByUserId_fkey";
-- DropForeignKey
ALTER TABLE "ProductType" DROP CONSTRAINT "ProductType_productGroupId_fkey";
-- DropForeignKey
ALTER TABLE "ProductType" DROP CONSTRAINT "ProductType_updatedByUserId_fkey";
-- DropForeignKey
ALTER TABLE "Service" DROP CONSTRAINT "Service_productTypeId_fkey";
-- AlterTable
ALTER TABLE "Product" DROP COLUMN "productTypeId",
ADD COLUMN "expenseType" TEXT,
ADD COLUMN "productGroupId" TEXT,
ADD COLUMN "vatIncluded" BOOLEAN;
-- AlterTable
ALTER TABLE "Service" DROP COLUMN "productTypeId",
ADD COLUMN "productGroupId" TEXT;
-- DropTable
DROP TABLE "ProductType";
-- AddForeignKey
ALTER TABLE "Product" ADD CONSTRAINT "Product_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Service" ADD CONSTRAINT "Service_productGroupId_fkey" FOREIGN KEY ("productGroupId") REFERENCES "ProductGroup"("id") ON DELETE SET NULL ON UPDATE CASCADE;