diff --git a/backend/sql/version_1.sql b/backend/sql/version_1.sql index 640fb9e..19b233c 100644 --- a/backend/sql/version_1.sql +++ b/backend/sql/version_1.sql @@ -257,9 +257,7 @@ CREATE TABLE [ShoppingEntry] ( -- In both cases [name], [quantity_value], [quantity_unit] and [Servings] are used to display -- the entry instead of [Ingredient] data. [ingredient_id] INTEGER, - - -- Can be null when manually added (entry is not linked to a recipe). - [recipe_scheduled_id] INTEGER, + [recipe_scheduled_id] INTEGER, -- Can be null when manually added. [is_checked] INTEGER NOT NULL DEFAULT FALSE, @@ -271,7 +269,16 @@ CREATE TABLE [ShoppingEntry] ( CHECK ( length([name]) <= 255 AND - ([is_checked] = TRUE OR [is_checked] = FALSE) + ([is_checked] = TRUE OR [is_checked] = FALSE) AND + ( + [recipe_scheduled_id] IS NULL OR + ( + [name] = '' AND + [quantity_value] IS NULL AND + [quantity_unit] = '' AND + [servings] IS NULL + ) + ) ), FOREIGN KEY([user_id]) REFERENCES [User]([id]) ON DELETE CASCADE, diff --git a/backend/templates/calendar.html b/backend/templates/calendar.html index b75fecb..b46d4bb 100644 --- a/backend/templates/calendar.html +++ b/backend/templates/calendar.html @@ -33,7 +33,7 @@ -