]> Nutra Git (v2) - nutratech/nt-sqlite.git/commitdiff
remove recipe table, use uuid in recipe
authorShane Jaroch <chown_tee@proton.me>
Sun, 24 Jul 2022 18:28:57 +0000 (14:28 -0400)
committerShane Jaroch <chown_tee@proton.me>
Sun, 24 Jul 2022 18:29:04 +0000 (14:29 -0400)
sql/tables.sql

index de48195921c5b14472bee6bb65abc2a424e10baa..484098616751cd863a7509a16c8a09574f99291f 100644 (file)
@@ -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,