-- Menge + Einheit an Rezeptzutaten; quantity_g bleibt die Standardeinheit (Gramm). ALTER TABLE food_recipe_ingredients ADD COLUMN IF NOT EXISTS quantity_amount NUMERIC(10,3), ADD COLUMN IF NOT EXISTS source_unit VARCHAR(20); COMMENT ON COLUMN food_recipe_ingredients.quantity_amount IS 'Menge in source_unit (z. B. 2 TL)'; COMMENT ON COLUMN food_recipe_ingredients.source_unit IS 'Kanonische Einheit: g, ml, el, tl, prise, stück, …'; COMMENT ON COLUMN food_recipe_ingredients.quantity_g IS 'Umrechnung auf Gramm, wenn Faktor bekannt'; UPDATE food_recipe_ingredients SET quantity_amount = quantity_g, source_unit = 'g' WHERE quantity_g IS NOT NULL AND quantity_amount IS NULL AND source_unit IS NULL; DO $$ BEGIN RAISE NOTICE 'Migration 066: recipe ingredient amount + unit'; END $$;