-- ============================================================================
-- Migration 002: Add conditional fields for Serie product type
-- Date: 2025-11-12
-- Description: Add Formato, Piattaforma to AnagraficaMedia and Delivery to LogAggiornamenti
-- ============================================================================

-- Add Formato and Piattaforma to AnagraficaMedia (Product attributes)
-- These fields are visible only for Serie type products in the UI
ALTER TABLE AnagraficaMedia
ADD COLUMN formato TEXT;

ALTER TABLE AnagraficaMedia
ADD COLUMN piattaforma TEXT;

-- Add Delivery to LogAggiornamenti (Market event attribute)
-- This field is visible for ALL product types (not just Serie)
ALTER TABLE LogAggiornamenti
ADD COLUMN delivery TEXT;

-- Create index on tipo for performance when filtering by product type
CREATE INDEX IF NOT EXISTS idx_anagrafica_tipo ON AnagraficaMedia(tipo);
