-- ===========================================================================
-- Migration: Alter supplier_recipe — fix portion_unit ENUM values
-- Date: 2026-05-06
-- Context: 'mm' (millimeters) was used instead of 'ml' (milliliters).
--          Expanding ENUM to support: g (grams), ml (milliliters),
--          szt (pieces), kg (kilograms), l (liters).
-- ===========================================================================

-- Step 1: Migrate existing 'mm' values to 'ml'
UPDATE `supplier_recipe`
SET `portion_unit` = 'ml'
WHERE `portion_unit` = 'mm';

-- Step 2: Change ENUM to include the correct set of units
-- Using MODIFY COLUMN to replace ENUM('g','mm') with ENUM('g','ml','szt','kg','l')
ALTER TABLE `supplier_recipe`
    MODIFY COLUMN `portion_unit`
        ENUM('g', 'ml', 'szt', 'kg', 'l') NULL DEFAULT NULL
        COMMENT 'Jednostka miary porcji: g (waga) | ml (objetosc) | szt (sztuki) | kg (kilogramy) | l (litry)';
