diff --git a/tables.sql b/tables.sql new file mode 100644 index 0000000..02330f1 --- /dev/null +++ b/tables.sql @@ -0,0 +1,27 @@ +CREATE DATABASE `IOT`; + +USE `IoT`; + +CREATE TABLE IF NOT EXISTS `user` ( + `id` int(8) NOT NULL AUTO_INCREMENT, + `name` varchar(32) NOT NULL, + PRIMARY KEY (id) +); + + +CREATE TABLE IF NOT EXISTS `training` ( + `trainingId` int(8) NOT NULL, + `trainingDate` DATE NOT NULL, + `userId` int(8) NOT NULL, + PRIMARY KEY (trainingId), + FOREIGN KEY (userId) REFERENCES user(id) +); + + +CREATE TABLE IF NOT EXISTS `lap` ( + `lapId` int(8) NOT NULL , + `lapTime` int(8) NOT NULL, + `trainingId` int(8) NOT NULL, + PRIMARY KEY (lapId, trainingId), + FOREIGN KEY (trainingId) REFERENCES training(trainingId) +); \ No newline at end of file -- libgit2 0.21.2