Fixed a problem with newer SQLite versions (references and fixes #133)

This commit is contained in:
Bernd Bestel 2019-01-05 20:28:21 +01:00
parent f6649d51bd
commit 43c9ab7734
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 21 additions and 0 deletions

View File

@ -29,6 +29,15 @@ FROM recipes_pos_old;
DROP TABLE recipes_pos_old; DROP TABLE recipes_pos_old;
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 = (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;
DROP VIEW recipes_fulfillment; DROP VIEW recipes_fulfillment;
CREATE VIEW recipes_fulfillment CREATE VIEW recipes_fulfillment
AS AS

12
migrations/0047.sql Normal file
View File

@ -0,0 +1,12 @@
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 = (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;
UPDATE recipes_pos
SET qu_id = (SELECT qu_id_stock FROM products WHERE id = recipes_pos.product_id)
WHERE only_check_single_unit_in_stock = 0;