Migration: Add variant pricing support to database schema
Critical fix for production deployment issue where code changes were deployed without corresponding database schema updates. Changes: - Add Price column to ProductVariants table (decimal 18,2, nullable) - Add ProductVariantId column to OrderItems table (TEXT, nullable) - Add index on OrderItems.ProductVariantId for query performance This migration was manually applied to production on 2025-10-04 to resolve "no such column: p2.Price" errors that broke the product catalog API. Future deployments must include database migration steps in CI/CD. 🤖 Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8ae548c268
commit
d8dcaa51c9
17
LittleShop/Migrations/AddVariantPricing.sql
Normal file
17
LittleShop/Migrations/AddVariantPricing.sql
Normal file
@ -0,0 +1,17 @@
|
||||
-- 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)
|
||||
Loading…
Reference in New Issue
Block a user