Comments (5)
@cfiliault Hey sir, I have a question in regards to creating a table. The weight log is supposed to be recorded weekly, so should I have a separate table for creating weight time log, and then another separate one for the calories time log.
So something like this?
CREATE TABLE calorie_log (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
time_id INTEGER REFERENCES calorie_timelog(id),
food TEXT
);
CREATE TABLE calorie_timelog (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
date DATETIME
);
CREATE TABLE calorie_log (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
time_id INTEGER REFERENCES calorie_timelog(id),
food TEXT
);
CREATE TABLE calorie_timelog (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
date DATETIME
);
Where calories are to be recorded daily, and weight is supposed to be recorded weekly.
from fitgrind.
Wait this is the new updated one, I'm not sure anymore
from fitgrind.
@cfiliault this is how my table looks so far. Calorie log is supposed to be recorded daily, where weight log table is recorded weekly. Is this db design right?
calorie_log table
id | time_id | food_id | date |
---|---|---|---|
PRIMARY KEY AUTOINCREMENT | FOREIGN KEY | FOREIGN KEY | DATETIME |
weight_log table
id | weight | date |
---|---|---|
PRIMARY KEY AUTOINCREMENT | FOREIGN KEY | DATETIME |
food table is from food class
id | name | blah | blah |
---|---|---|---|
PRIMARY KEY AUTOINCREMENT | blah | blah | blah |
from fitgrind.
Updated DB Format
This is almost official, but it's looking like this:
CREATE TABLE weight_log (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
weight FLOAT,
DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE food (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
name TEXT,
weight INTEGER,
measure TEXT,
);
CREATE TABLE calorie_log (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
food_id INTEGER REFERENCES food(id),
DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)l
CREATE TABLE progress (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
resource TEXT NOT NULL
);
CREATE TABLE image_location (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
image_id INTEGER REFERENCES progress(id),
DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE workout (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
name VARCHAR(30),
set INTEGER,
rep INTEGER
);
CREATE TABLE workout_day (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
day VARCHAR(9)
);
CREATE TABLE workout_schedule (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
workout_id INTEGER REFERENCES workout(id),
workout_day_id INTEGER REFERENCES workout_day(id)
);
from fitgrind.
I'll have this done ASAP. This needs to be finished, before we can continue on with the others.
from fitgrind.
Related Issues (20)
- Refactor Database Helper
- Diary Calorie Log Screen
- Food Search Screen
- Custom Food Screen
- Weight Log Screen
- Settings Screen
- Adjust Weight Log Screen
- Convert Java to Kotlin
- Redesign Project
- Integrate Calendar on Calories Page HOT 2
- Properly Add Nutrients
- Sketch an ERD Diagram for Database
- Remove Timer
- Fix date issue for SQLite on Adding Food
- Integrate Calendar on Workout
- Integrate Travis CI
- Integrate RxJava
- Create a multi-fab button
- Redesign TextField to Material Components
- Create Proper Search Using Observable debounce
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fitgrind.