-- Migration: Add Variant Pricing Support
-- Date: 2025-10-03
-- Description: Adds Price field to ProductVariants table and ProductVariantId to OrderItems table

-- Add Price column to ProductVariants table
ALTER TABLE ProductVariants ADD COLUMN Price decimal(18,2) NULL;

-- Add ProductVariantId column to OrderItems table
ALTER TABLE OrderItems ADD COLUMN ProductVariantId TEXT NULL;

-- Add index on ProductVariantId for performance
CREATE INDEX IF NOT EXISTS IX_OrderItems_ProductVariantId ON OrderItems (ProductVariantId);

-- Migration complete
-- No data migration needed - existing records will have NULL values which is correct
-- Variant Price defaults to NULL (uses product base price)
-- OrderItems ProductVariantId defaults to NULL (no variant selected)
