mirror of
https://github.com/grocy/grocy.git
synced 2026-03-28 15:49:25 +01:00
Delete QU conversions when deleting QU (theoretical problem, closes #1796)
This commit is contained in:
parent
777fcbae77
commit
5bfdddd52b
10
migrations/0171.sql
Normal file
10
migrations/0171.sql
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
CREATE TRIGGER remove_conversions AFTER DELETE ON quantity_units
|
||||
BEGIN
|
||||
DELETE FROM quantity_unit_conversions
|
||||
WHERE from_qu_id = OLD.id
|
||||
OR to_qu_id = OLD.id;
|
||||
END;
|
||||
|
||||
DELETE FROM quantity_unit_conversions
|
||||
WHERE NOT EXISTS(SELECT 1 FROM quantity_units WHERE id = quantity_unit_conversions.from_qu_id)
|
||||
OR NOT EXISTS(SELECT 1 FROM quantity_units WHERE id = quantity_unit_conversions.to_qu_id);
|
||||
Loading…
Reference in New Issue
Block a user