database creation (mysql script)

This commit is contained in:
Sam 2017-08-26 22:09:51 +02:00
parent 54ed130a2e
commit bb88c9494f
3 changed files with 73 additions and 21 deletions

View File

@ -20,10 +20,10 @@
<y:Geometry height="143.0" width="107.0" x="821.44" y="96.0"/>
<y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="37.603515625" x="34.6982421875" y="4.0">Users</y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="36.42578125" x="35.287109375" y="4.0">users</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="101.78125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="top" visible="true" width="67.48046875" x="2.0" y="29.96875">id
username
password
pwd
first_name
last_name
birthday
@ -47,12 +47,12 @@ photo
<y:Geometry height="253.0" width="206.0" x="769.44" y="274.28"/>
<y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="58.955078125" x="73.5224609375" y="4.0">Activities</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="199.5625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="top" visible="true" width="72.396484375" x="2.0" y="29.96875">id
id_user
id_sport
id_gpx
date
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="58.099609375" x="73.9501953125" y="4.0">activities</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="199.5625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="top" visible="true" width="81.291015625" x="2.0" y="29.96875">id
user_id
sport_id
gpx_id
activity_date
duration
pauses
distance
@ -80,7 +80,7 @@ ave_speed<y:LabelModel>
<y:Geometry height="90.0" width="80.0" x="1060.28" y="355.78"/>
<y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="42.466796875" x="18.7666015625" y="4.0">Sports</y:NodeLabel>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="41.1015625" x="19.44921875" y="4.0">sports</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="31.9375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="top" visible="true" width="33.021484375" x="2.0" y="29.96875">id
label<y:LabelModel>
<y:ErdAttributesNodeLabelModel/>
@ -101,9 +101,9 @@ label<y:LabelModel>
<y:Geometry height="90.0" width="80.0" x="832.44" y="598.56"/>
<y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="28.755859375" x="25.6220703125" y="4.0">GPX</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="31.9375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="top" visible="true" width="56.306640625" x="2.0" y="29.96875">id
filename<y:LabelModel>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="26.3359375" x="26.83203125" y="4.0">gpx</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="31.9375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="top" visible="true" width="22.275390625" x="2.0" y="29.96875">id
file<y:LabelModel>
<y:ErdAttributesNodeLabelModel/>
</y:LabelModel>
<y:ModelParameter>
@ -122,10 +122,10 @@ filename<y:LabelModel>
<y:Geometry height="112.0" width="138.0" x="546.6000000000001" y="344.78"/>
<y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="103.90234375" x="17.048828125" y="4.0">PersonalRecords</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="59.875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="top" visible="true" width="75.05078125" x="2.0" y="29.96875">id
id_activities
type
<y:NodeLabel alignment="center" autoSizePolicy="content" backgroundColor="#B7C9E3" configuration="com.yworks.entityRelationship.label.name" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="104.283203125" x="16.8583984375" y="4.0">personalRecords</y:NodeLabel>
<y:NodeLabel alignment="left" autoSizePolicy="content" configuration="com.yworks.entityRelationship.label.attributes" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="59.875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="top" visible="true" width="75.61328125" x="2.0" y="29.96875">id
activity_id
record_type
value<y:LabelModel>
<y:ErdAttributesNodeLabelModel/>
</y:LabelModel>
@ -140,7 +140,6 @@ value<y:LabelModel>
</data>
</node>
<edge id="e0" source="n1" target="n3">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -151,7 +150,6 @@ value<y:LabelModel>
</data>
</edge>
<edge id="e1" source="n1" target="n0">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -162,7 +160,6 @@ value<y:LabelModel>
</data>
</edge>
<edge id="e2" source="n4" target="n0">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
@ -175,7 +172,6 @@ value<y:LabelModel>
</data>
</edge>
<edge id="e3" source="n2" target="n1">
<data key="d9"/>
<data key="d10">
<y:GenericEdge configuration="com.yworks.bpmn.Connection">
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
@ -188,7 +184,6 @@ value<y:LabelModel>
</data>
</edge>
<edge id="e4" source="n1" target="n4">
<data key="d9"/>
<data key="d10">
<y:GenericEdge configuration="com.yworks.bpmn.Connection">
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>

57
docs/db/mpwo.sql Normal file
View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB