migration: add matrix variants schema migration

This commit is contained in:
Your Name committed 2026-06-24 18:09:16 -04:00
1 parent fb46bd71ed
commit 81ed9af406
1 file changed
+20
@@ -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");