mirror of
https://github.com/grocy/grocy.git
synced 2026-03-27 23:29:25 +01:00
Use products stock QU for product_barcodes when empty (references #1794)
This commit is contained in:
parent
8abb55b058
commit
777fcbae77
19
migrations/0170.sql
Normal file
19
migrations/0170.sql
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
CREATE TRIGGER default_qu_INS AFTER INSERT ON product_barcodes
|
||||
BEGIN
|
||||
UPDATE product_barcodes
|
||||
SET qu_id = (SELECT qu_id_stock FROM products WHERE id = product_barcodes.product_id)
|
||||
WHERE id = NEW.id
|
||||
AND IFNULL(qu_id, 0) = 0;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER default_qu_UPD AFTER UPDATE ON product_barcodes
|
||||
BEGIN
|
||||
UPDATE product_barcodes
|
||||
SET qu_id = (SELECT qu_id_stock FROM products WHERE id = product_barcodes.product_id)
|
||||
WHERE id = NEW.id
|
||||
AND IFNULL(qu_id, 0) = 0;
|
||||
END;
|
||||
|
||||
UPDATE product_barcodes
|
||||
SET qu_id = (SELECT qu_id_stock FROM products WHERE id = product_barcodes.product_id)
|
||||
WHERE IFNULL(qu_id, 0) = 0;
|
||||
Loading…
Reference in New Issue
Block a user