diff --git a/docs/dbm/mpwo.graphml b/docs/db/mpwo.graphml similarity index 93% rename from docs/dbm/mpwo.graphml rename to docs/db/mpwo.graphml index 0c3aec39..e243311f 100644 --- a/docs/dbm/mpwo.graphml +++ b/docs/db/mpwo.graphml @@ -20,10 +20,10 @@ - Users + users id username -password +pwd first_name last_name birthday @@ -47,12 +47,12 @@ photo - Activities - id -id_user -id_sport -id_gpx -date + activities + id +user_id +sport_id +gpx_id +activity_date duration pauses distance @@ -80,7 +80,7 @@ ave_speed - Sports + sports id label @@ -101,9 +101,9 @@ label - GPX - id -filename + gpx + id +file @@ -122,10 +122,10 @@ filename - PersonalRecords - id -id_activities -type + personalRecords + id +activity_id +record_type value @@ -140,7 +140,6 @@ value - @@ -151,7 +150,6 @@ value - @@ -162,7 +160,6 @@ value - @@ -175,7 +172,6 @@ value - @@ -188,7 +184,6 @@ value - diff --git a/docs/db/mpwo.sql b/docs/db/mpwo.sql new file mode 100644 index 00000000..aa4e4957 --- /dev/null +++ b/docs/db/mpwo.sql @@ -0,0 +1,57 @@ +CREATE DATABASE IF NOT EXISTS mpwo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +USE mpwo; + +CREATE TABLE users ( +id int(4) UNSIGNED NOT NULL AUTO_INCREMENT, +username varchar(20) NOT NULL, +pwd varchar(64) NOT NULL, +first_name varchar(50) NOT NULL, +last_name varchar(50) NOT NULL, +birthday date, +photo BLOB, +PRIMARY KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE sports ( +id int(4) UNSIGNED NOT NULL AUTO_INCREMENT, +label varchar(50) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE gpx ( +id int(4) UNSIGNED NOT NULL AUTO_INCREMENT, +file BLOB NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE activities ( +id int(4) UNSIGNED NOT NULL AUTO_INCREMENT, +user_id int(4) UNSIGNED NOT NULL, +sport_id int(4) UNSIGNED NOT NULL, +gpx_id int(4), +activity_date datetime NOT NULL, +duration int(4) NOT NULL, +pauses int(4), +distance int(4), +min_alt int(4), +max_alt int(4), +descent int(4), +ascent int(4), +max_speed int(4), +ave_speed int(4), +PRIMARY KEY (id), +FOREIGN KEY (user_id) + REFERENCES users(id), +FOREIGN KEY (sport_id) + REFERENCES sports(id) +) ENGINE=InnoDB; + +CREATE TABLE personalRecords ( +id int(4) UNSIGNED NOT NULL AUTO_INCREMENT, +activity_id int(4) UNSIGNED NOT NULL, +record_type varchar(50) NOT NULL, +value int(4), +PRIMARY KEY (id), +FOREIGN KEY (activity_id) + REFERENCES activities(id) +) ENGINE=InnoDB; \ No newline at end of file diff --git a/docs/img/mpwo.png b/docs/img/mpwo.png index 1fd73d8d..5157cdeb 100644 Binary files a/docs/img/mpwo.png and b/docs/img/mpwo.png differ