-- Add EAN (barcode) and Manufacturer fields to products
-- Manufacturer will be used for autocomplete across products in a company

ALTER TABLE product_read_models
ADD COLUMN IF NOT EXISTS ean TEXT,
ADD COLUMN IF NOT EXISTS manufacturer TEXT;

-- Index for EAN lookup (useful for scanning barcodes)
CREATE INDEX IF NOT EXISTS idx_product_ean
ON product_read_models (company_id, ean) WHERE ean IS NOT NULL;

-- Index for manufacturer autocomplete
CREATE INDEX IF NOT EXISTS idx_product_manufacturer
ON product_read_models (company_id, manufacturer) WHERE manufacturer IS NOT NULL;
