chore: migration

This commit is contained in:
Methapon2001 2025-01-27 11:50:21 +07:00
parent 8535924d53
commit 24e379fbf4
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,17 @@
/*
Warnings:
- Made the column `vatIncluded` on table `Product` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "Product" ADD COLUMN "agentPriceCalcVat" BOOLEAN,
ADD COLUMN "agentPriceVatIncluded" BOOLEAN,
ADD COLUMN "serviceChargeCalcVat" BOOLEAN,
ADD COLUMN "serviceChargeVatIncluded" BOOLEAN,
ALTER COLUMN "vatIncluded" SET NOT NULL,
ALTER COLUMN "vatIncluded" SET DEFAULT true;
UPDATE "Product" SET "agentPriceCalcVat" = "Product"."calcVat" WHERE "agentPriceCalcVat" IS NULL;
UPDATE "Product" SET "agentPriceVatIncluded" = "Product"."vatIncluded" WHERE "agentPriceVatIncluded" IS NULL;
UPDATE "Product" SET "serviceChargeCalcVat" = "Product"."calcVat" WHERE "serviceChargeCalcVat" IS NULL;
UPDATE "Product" SET "serviceChargeVatIncluded" = "Product"."vatIncluded" WHERE "serviceChargeVatIncluded" IS NULL;

View file

@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "Product" ALTER COLUMN "agentPriceCalcVat" SET DEFAULT true,
ALTER COLUMN "agentPriceVatIncluded" SET DEFAULT true,
ALTER COLUMN "serviceChargeCalcVat" SET DEFAULT true,
ALTER COLUMN "serviceChargeVatIncluded" SET DEFAULT true;