Cascade changes of stock quantity unit of products to recipe positions (fixes #91)

This commit is contained in:
Bernd Bestel 2018-10-20 11:17:51 +02:00
parent f13abf483e
commit 70c00e81d9
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

7
migrations/0042.sql Normal file
View File

@ -0,0 +1,7 @@
CREATE TRIGGER cascade_change_qu_id_stock AFTER UPDATE ON products
BEGIN
UPDATE recipes_pos
SET qu_id = (SELECT qu_id_stock FROM products WHERE id = NEW.id)
WHERE product_id IN (SELECT id FROM products WHERE id = NEW.id)
AND only_check_single_unit_in_stock = 0;
END;