diff --git a/prisma/migrations/20250127043028_add_product_field/migration.sql b/prisma/migrations/20250127043028_add_product_field/migration.sql new file mode 100644 index 0000000..2cb2cab --- /dev/null +++ b/prisma/migrations/20250127043028_add_product_field/migration.sql @@ -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; diff --git a/prisma/migrations/20250127044659_add_default_value_to_new_field/migration.sql b/prisma/migrations/20250127044659_add_default_value_to_new_field/migration.sql new file mode 100644 index 0000000..a547761 --- /dev/null +++ b/prisma/migrations/20250127044659_add_default_value_to_new_field/migration.sql @@ -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;