Giter Site home page Giter Site logo

Database Scheme about fitgrind HOT 5 CLOSED

j-nguyen avatar j-nguyen commented on August 28, 2024
Database Scheme

from fitgrind.

Comments (5)

j-nguyen avatar j-nguyen commented on August 28, 2024

@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.

j-nguyen avatar j-nguyen commented on August 28, 2024

img_20170329_122247

Wait this is the new updated one, I'm not sure anymore

from fitgrind.

j-nguyen avatar j-nguyen commented on August 28, 2024

@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.

j-nguyen avatar j-nguyen commented on August 28, 2024

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.

j-nguyen avatar j-nguyen commented on August 28, 2024

I'll have this done ASAP. This needs to be finished, before we can continue on with the others.

from fitgrind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.