-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
42 lines (38 loc) · 1.22 KB
/
schema.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
31
32
33
34
35
36
37
38
39
40
41
42
CREATE TABLE IF NOT EXISTS Doctors(
doctorid INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT NOT NULL,
password TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS Patients(
patientid INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
age INTEGER NOT NULL,
sex TEXT NOT NULL,
description TEXT);
CREATE TABLE IF NOT EXISTS ExerciseProfiles(
profileid INTEGER PRIMARY KEY AUTOINCREMENT,
doctorid INTEGER NOT NULL,
patientid INTEGER NOT NULL,
description TEXT,
profile TEXT,
lastused TEXT,
FOREIGN KEY (doctorid) REFERENCES Doctors(doctorid),
FOREIGN KEY (patientid) REFERENCES Patients(patientid)
);
CREATE TABLE IF NOT EXISTS DP(
doctorid INTEGER NOT NULL,
patientid INTEGER NOT NULL,
FOREIGN KEY (doctorid) REFERENCES Doctors(doctorid),
FOREIGN KEY (patientid) REFERENCES Patients(patientid)
);
CREATE TABLE IF NOT EXISTS TrainingsLedger(
trainingid INTEGER PRIMARY KEY AUTOINCREMENT,
doctorid INTEGER NOT NULL,
patientid INTEGER NOT NULL,
profileid INTEGER NOT NULL,
repetitions INTEGER NOT NULL,
timestamp TEXT NOT NULL,
FOREIGN KEY (profileid) REFERENCES ExerciseProfiles(profileid),
FOREIGN KEY (doctorid) REFERENCES Doctors(doctorid),
FOREIGN KEY (patientid) REFERENCES Patients(patientid)
);