-- Migration: Make product price nullable to support price inheritance from models
-- Date: 2026-05-08
-- Description: Products can now inherit price from their assigned model's base_price

-- Make price column nullable
ALTER TABLE product ALTER COLUMN price DROP NOT NULL;

-- Add a check constraint to ensure either product has a price OR is linked to a model
-- Note: This is a soft constraint - the application logic enforces it
-- We don't add a DB constraint because it would be complex with the model relationship

-- Add a comment to document this behavior
COMMENT ON COLUMN product.price IS 'Product-specific price. If NULL, inherits from model.base_price';
