From 2c5b817d0f83f953b828caaec7aee94ddb7efc91 Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Sun, 24 Jul 2022 14:28:57 -0400 Subject: [PATCH] remove recipe table, use uuid in recipe --- sql/tables.sql | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/sql/tables.sql b/sql/tables.sql index de48195..4840986 100644 --- a/sql/tables.sql +++ b/sql/tables.sql @@ -97,38 +97,6 @@ CREATE TABLE cf_dat ( FOREIGN KEY (cf_id) REFERENCES custom_food (id) ON UPDATE CASCADE ON DELETE CASCADE ); --- --------------------------------- --- Recipe --------------------------------- -CREATE TABLE recipe ( - id integer PRIMARY KEY AUTOINCREMENT, - tagname text NOT NULL UNIQUE, - name text NOT NULL UNIQUE, - created int DEFAULT (strftime ('%s', 'now')) -); - -CREATE TABLE recipe_dat ( - recipe_id int NOT NULL, - food_id int NOT NULL, - grams real NOT NULL, - notes text, - created int DEFAULT (strftime ('%s', 'now')), - PRIMARY KEY (recipe_id, food_id), - FOREIGN KEY (recipe_id) REFERENCES recipe (id) ON UPDATE CASCADE ON DELETE CASCADE -); - -CREATE TABLE recipe_dat_cf ( - recipe_id int NOT NULL, - custom_food_id int NOT NULL, - grams real NOT NULL, - notes text, - created int DEFAULT (strftime ('%s', 'now')), - PRIMARY KEY (recipe_id, custom_food_id), - FOREIGN KEY (recipe_id) REFERENCES recipe (id) ON UPDATE CASCADE ON DELETE CASCADE, - FOREIGN KEY (custom_food_id) REFERENCES cf (id) ON UPDATE CASCADE ON DELETE CASCADE -); - -- -------------------------------- -- Food (and recipe) logs @@ -173,7 +141,7 @@ CREATE TABLE log_recipe ( profile_id int NOT NULL, date int DEFAULT (strftime ('%s', 'now')), meal_id int NOT NULL, - recipe_id int NOT NULL, + recipe_uuid text NOT NULL, grams real NOT NULL, created int DEFAULT (strftime ('%s', 'now')), FOREIGN KEY (profile_id) REFERENCES profile (id) ON UPDATE CASCADE ON DELETE CASCADE, -- 2.52.0