Only cascade changes of stock QU to recipe ingredients which uses the same QU (references #177)

This commit is contained in:
Bernd Bestel
2019-09-17 16:01:30 +02:00
parent 74f9470769
commit 1b19940aba
2 changed files with 10 additions and 1 deletions

View File

@@ -102,3 +102,12 @@ JOIN quantity_units qu_from
ON quc.from_qu_id = qu_from.id
JOIN quantity_units qu_to
ON quc.to_qu_id = qu_to.id;
DROP TRIGGER cascade_change_qu_id_stock;
CREATE TRIGGER cascade_change_qu_id_stock AFTER UPDATE ON products
BEGIN
UPDATE recipes_pos
SET qu_id = NEW.qu_id_stock
WHERE product_id = NEW.id
AND qu_id = OLD.qu_id_stock;
END;