mirror of
https://github.com/grocy/grocy.git
synced 2026-03-28 07:39:25 +01:00
Enforce product nesting level also for the API
This commit is contained in:
parent
4c7318acd7
commit
2e01ecbe58
10
migrations/0121.sql
Normal file
10
migrations/0121.sql
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
CREATE TRIGGER enfore_product_nesting_level BEFORE UPDATE ON products
|
||||
BEGIN
|
||||
-- Currently only 1 level is supported
|
||||
SELECT CASE WHEN((
|
||||
SELECT 1
|
||||
FROM products p
|
||||
WHERE IFNULL(NEW.parent_product_id, '') != ''
|
||||
AND IFNULL(parent_product_id, '') = NEW.id
|
||||
) NOTNULL) THEN RAISE(ABORT, "Unsupported product nesting level detected (currently only 1 level is supported)") END;
|
||||
END;
|
||||
Loading…
Reference in New Issue
Block a user