jws-backend/prisma/migrations/20250127043028_add_product_field/migration.sql

18 lines
893 B
MySQL
Raw Normal View History

2025-01-27 11:50:21 +07:00
/*
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;