From: gamesguru Date: Fri, 28 May 2021 01:50:25 +0000 (-0400) Subject: rename meals -> meal_name X-Git-Tag: 0.0.4~7 X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=101b9322f819699bd170fb69e855f125bce85aff;p=nutratech%2Fnt-sqlite.git rename meals -> meal_name --- diff --git a/docs/nt.svg b/docs/nt.svg index d37a306..3b6a0ba 100644 --- a/docs/nt.svg +++ b/docs/nt.svg @@ -4,326 +4,323 @@ - - + + undefined - -nt.sqlite + +nt.sqlite version - -version - -id* -integer -version -text -created -date -notes -text + +version + +id* +integer +version +text +created +date +notes +text bmr_eqs - -bmr_eqs - -id* -integer -name -text + +bmr_eqs + +id* +integer +name +text bf_eqs - -bf_eqs - -id* -integer -name -text + +bf_eqs + +id* +integer +name +text profiles - -profiles - -id* -integer -name -text -guid -text -created -int -updated -int -last_sync -int -eula -int -gender -text -dob -date -act_lvl -int -goal_wt -real -goal_bf -real -bmr_eq_id -int -bf_eq_id -int + +profiles + +id* +integer +name +text +created +int +updated +int +eula +int +gender +text +dob +date +act_lvl +int +goal_wt +real +goal_bf +real +bmr_eq_id +int +bf_eq_id +int profiles->bmr_eqs - - + + profiles->bf_eqs - - + + - + +food_costs + +food_costs + +food_id* +integer +profile_id* +integer +cost +real + + + +food_costs->profiles + + + + + biometrics - -biometrics - -id* -integer -name -text -unit -text -created -int + +biometrics + +id* +integer +created +int +updated +int +name +text +unit +text - + biometric_log - -biometric_log - -id* -integer -guid -text -profile_id -int -created -int -updated -int -last_sync -int -date -int -tags -text -notes -text + +biometric_log + +id* +integer +profile_id +int +created +int +updated +int +date +int +tags +text +notes +text - + biometric_log->profiles - - + + - + bio_log_entry - -bio_log_entry - -log_id* -int -biometric_id* -int -value -real + +bio_log_entry + +log_id* +int +biometric_id* +int +value +real - + bio_log_entry->biometrics - - + + - + bio_log_entry->biometric_log - - + + - + recipes - -recipes - -id* -integer -guid -text -created -int -updated -int -last_sync -int -name -text + +recipes + +id* +integer +created +int +updated +int +tagname +text +name +text - + recipe_dat - -recipe_dat - -recipe_id* -int -food_id* -int -grams -real -notes -text + +recipe_dat + +recipe_id* +int +food_id* +int +grams +real +notes +text - + recipe_dat->recipes - - + + - - -meals - -meals - -id* -integer -name -text + + +meal_name + +meal_name + +id* +integer +name +text - + food_log - -food_log - -id* -integer -guid -text -profile_id -int -created -int -updated -int -last_sync -int -date -date -meal_id -int -food_id -int -grams -real + +food_log + +id* +integer +profile_id +int +created +int +updated +int +date +int +meal_id +int +food_id +int +grams +real - + food_log->profiles - - + + - - -food_log->meals - - + + +food_log->meal_name + + - + recipe_log - -recipe_log - -id* -integer -guid -text -profile_id -int -created -int -updated -int -last_sync -int -date -date -meal_id -int -recipe_id -int -grams -real + +recipe_log + +id* +integer +profile_id +int +created +int +updated +int +date +int +meal_id +int +recipe_id +int +grams +real - + recipe_log->profiles - - + + - + recipe_log->recipes - - + + - - -recipe_log->meals - - + + +recipe_log->meal_name + + - + rda - -rda - -profile_id* -int -created -int -updated -int -last_sync -int -nutr_id* -int -rda -real + +rda + +profile_id* +int +nutr_id* +int +rda +real - + rda->profiles - - + + diff --git a/sql/data/meals.csv b/sql/data/meal_name.csv similarity index 100% rename from sql/data/meals.csv rename to sql/data/meal_name.csv diff --git a/sql/tables.sql b/sql/tables.sql index 24ddab4..b16bdc9 100644 --- a/sql/tables.sql +++ b/sql/tables.sql @@ -130,7 +130,7 @@ CREATE TABLE recipe_dat ( -- Food (and recipe) logs -------------------------------- -CREATE TABLE meals ( +CREATE TABLE meal_name ( -- predefined, includes standard three, snacks, brunch, and 3 optional/extra meals id integer PRIMARY KEY AUTOINCREMENT, name text NOT NULL @@ -146,7 +146,7 @@ CREATE TABLE food_log ( food_id int NOT NULL, grams real NOT NULL, FOREIGN KEY (profile_id) REFERENCES profiles (id) ON UPDATE CASCADE, - FOREIGN KEY (meal_id) REFERENCES meals (id) ON UPDATE CASCADE + FOREIGN KEY (meal_id) REFERENCES meal_name (id) ON UPDATE CASCADE ); CREATE TABLE recipe_log ( @@ -159,7 +159,7 @@ CREATE TABLE recipe_log ( recipe_id int NOT NULL, grams real NOT NULL, FOREIGN KEY (profile_id) REFERENCES profiles (id) ON UPDATE CASCADE, - FOREIGN KEY (meal_id) REFERENCES meals (id) ON UPDATE CASCADE, + FOREIGN KEY (meal_id) REFERENCES meal_name (id) ON UPDATE CASCADE, FOREIGN KEY (recipe_id) REFERENCES recipes (id) ON UPDATE CASCADE );