From 81ed9af40636cb12e223ec792248a8bcb2cb41ac Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 24 Jun 2026 18:09:16 -0400 Subject: [PATCH] migration: add matrix variants schema migration --- .../migration.sql | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 apps/backend/prisma/migrations/20260624220800_add_matrix_variants/migration.sql diff --git a/apps/backend/prisma/migrations/20260624220800_add_matrix_variants/migration.sql b/apps/backend/prisma/migrations/20260624220800_add_matrix_variants/migration.sql new file mode 100644 index 0000000..cc1de30 --- /dev/null +++ b/apps/backend/prisma/migrations/20260624220800_add_matrix_variants/migration.sql @@ -0,0 +1,20 @@ +-- DropIndex +DROP INDEX "ProductVariant_productId_size_key"; + +-- AlterTable +ALTER TABLE "Product" ADD COLUMN "options" JSONB DEFAULT '[]'; + +-- AlterTable +ALTER TABLE "ProductVariant" DROP COLUMN "size", +ADD COLUMN "barcode" TEXT, +ADD COLUMN "option1" TEXT NOT NULL DEFAULT '', +ADD COLUMN "option2" TEXT NOT NULL DEFAULT '', +ADD COLUMN "option3" TEXT NOT NULL DEFAULT '', +ADD COLUMN "sku" TEXT, +ADD COLUMN "stock" INTEGER NOT NULL DEFAULT 0; + +-- CreateIndex +CREATE UNIQUE INDEX "ProductVariant_sku_key" ON "ProductVariant"("sku"); + +-- CreateIndex +CREATE UNIQUE INDEX "ProductVariant_productId_option1_option2_option3_key" ON "ProductVariant"("productId", "option1", "option2", "option3");