Fixed/workaround for recipes_nestings_resolved view when recipe count > 100 (fixes #403)

This commit is contained in:
Bernd Bestel 2019-10-01 15:34:20 +02:00
parent 35b569c832
commit 901b345714
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,2 @@
### Recipe fixes
- Fixed that recipes were displayed without ingredients if the total recipe count was > 100

19
migrations/0093.sql Normal file
View File

@ -0,0 +1,19 @@
DROP VIEW recipes_nestings_resolved;
CREATE VIEW recipes_nestings_resolved
AS
WITH RECURSIVE r1(recipe_id, includes_recipe_id, includes_servings)
AS (
SELECT id, id, 1
FROM recipes
UNION ALL
SELECT rn.recipe_id, r1.includes_recipe_id, rn.servings
FROM recipes_nestings rn, r1 r1
WHERE rn.includes_recipe_id = r1.recipe_id
LIMIT 1000000000 -- This is just a safety limit to prevent infinite loops due to infinite nested recipes
)
SELECT
*,
1 AS id -- Dummy, LessQL needs an id column
FROM r1;