Files
Nils-Johan Gynther 1604751b65 feat(receipt-import): add rule-based category suggestion logic for items
feat(migrations): add new categories for lactose-free products and allergy options
2026-05-02 16:42:33 +02:00

16 lines
440 B
SQL

-- Ensure L3 "Allergi matlagning" exists under:
-- Mejeri, ost & ägg > Matlagning
INSERT INTO `Category` (`name`, `parentId`)
SELECT 'Allergi matlagning', c2.id
FROM `Category` c1
JOIN `Category` c2
ON c2.parentId = c1.id
AND c2.name = 'Matlagning'
LEFT JOIN `Category` c3
ON c3.parentId = c2.id
AND c3.name = 'Allergi matlagning'
WHERE c1.name = 'Mejeri, ost & ägg'
AND c1.parentId IS NULL
AND c3.id IS NULL;