-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_setup.sql
30 lines (30 loc) · 863 Bytes
/
db_setup.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
CREATE DATABASE IF NOT EXISTS fitnessApp;
CREATE TABLE fitnessApp.users (
user_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
birthday DATE,
first_name VARCHAR(25),
last_name VARCHAR(25),
email VARCHAR(254),
username VARCHAR(254),
password VARCHAR(254),
updated_at TIMESTAMP,
created_at TIMESTAMP,
is_enabled BOOLEAN,
before_pic LONGBLOB NOT NULL,
after_pic LONGBLOB NOT NULL,
PRIMARY KEY(user_id)) ENGINE=INNODB;
CREATE TABLE fitnessApp.workouts (
workout_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
push_ups INT,
sit_ups INT,
dips INT,
running INT,
jumping_jacks INT,
burpees INT,
active_user_id INT UNSIGNED NOT NULL,
PRIMARY KEY(workout_id),
FOREIGN KEY (active_user_id)
REFERENCES users(user_id)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=INNODB;