Ingredients can now be added to shopping list when a recipe is scheduled

This commit is contained in:
Greg Burri 2025-02-10 15:02:20 +01:00
parent 15173c4842
commit ce3821b94e
12 changed files with 98 additions and 39 deletions

View file

@ -186,6 +186,8 @@ CREATE TABLE [ShoppingEntry] (
-- In both cases [name], [quantity_value] and [quantity_unit] are used to display
-- the entry instead of [Ingredient] data.
[ingredient_id] INTEGER,
[recipe_scheduled_id] INTEGER, -- Can be null when manually added.
[is_checked] INTEGER NOT NULL DEFAULT FALSE,
[name] TEXT NOT NULL DEFAULT '',
@ -194,7 +196,8 @@ CREATE TABLE [ShoppingEntry] (
[servings] INTEGER,
FOREIGN KEY([user_id]) REFERENCES [User]([id]) ON DELETE CASCADE,
FOREIGN KEY([ingredient_id]) REFERENCES [Ingredient]([id]) ON DELETE SET NULL
FOREIGN KEY([ingredient_id]) REFERENCES [Ingredient]([id]) ON DELETE SET NULL,
FOREIGN KEY([recipe_scheduled_id]) REFERENCES [RecipeScheduled]([id]) ON DELETE SET NULL
);
-- When an ingredient is deleted, its values are copied to any shopping entry