Former-commit-id: 33447e3bc791f2355592162428c255938b19cba6
This commit is contained in:
Ben
2022-01-31 21:16:53 +00:00
parent 3d77bf4358
commit 9bef06bf98
2 changed files with 110 additions and 6 deletions

View File

@@ -1,19 +1,79 @@
<?xml version="1.0" encoding="UTF-8" ?>
<project name="AppEng 2021/22" id="Project-1b11" database="LogicalDesign" >
<project name="AppEng 2021/22" id="Project-1f6c" database="Sqlite" >
<schema name="AppEng 2021/22" >
<table name="LegoBrick" >
<column name="id" type="varchar" length="16" jt="12" mandatory="y" />
<column name="name" type="varchar" length="100" jt="12" mandatory="y" />
<table name="Brick" prior="LegoBrick" >
<column name="id" type="varchar" length="20" jt="12" mandatory="y" />
<column name="name" type="text" length="100" jt="-1" mandatory="y" />
<column name="colour" type="integer" jt="4" />
<column name="catagory" type="integer" jt="4" />
<column name="weight" type="decimal" jt="3" />
<column name="dimensions_x" type="integer" jt="4" />
<column name="dimensions_y" type="integer" jt="4" />
<column name="dimensions_z" type="integer" jt="4" />
<index name="pk_LegoBrick" unique="PRIMARY_KEY" >
<column name="id" />
</index>
<fk name="fk_colour" to_schema="AppEng 2021/22" to_table="BrickColour" >
<fk_column name="colour" pk="id" />
</fk>
<fk name="fk_catagory" to_schema="AppEng 2021/22" to_table="Catagory" >
<fk_column name="catagory" pk="id" />
</fk>
</table>
<table name="BrickColour" prior="Brc" >
<column name="id" type="integer" jt="4" mandatory="y" />
<column name="name" type="varchar" length="100" jt="12" />
<column name="hexrgb" type="varchar" length="6" jt="12" mandatory="y" />
<column name="type" prior="is_transparent" type="integer" jt="4" />
<column name="date_from" type="date" jt="91" />
<column name="date_to" type="date" jt="91" />
<index name="pk_BrickColour" unique="PRIMARY_KEY" >
<column name="id" />
</index>
<fk name="fk_ColourType" to_schema="AppEng 2021/22" to_table="ColourType" >
<fk_column name="type" pk="id" />
</fk>
</table>
<table name="Catagory" prior="Tbl_0" >
<column name="id" type="integer" jt="4" mandatory="y" />
<column name="name" type="varchar" length="100" jt="12" />
<index name="pk_Catagory" unique="PRIMARY_KEY" >
<column name="id" />
</index>
</table>
<table name="ColourType" prior="Tbl" >
<column name="id" type="integer" jt="4" mandatory="y" />
<column name="type" type="varchar" length="64" jt="12" />
<index name="pk_ColourType" unique="PRIMARY_KEY" >
<column name="id" />
</index>
</table>
<table name="Set" prior="Tbl" >
<column name="id" type="varchar" length="20" jt="12" mandatory="y" />
<column name="catagory" type="integer" jt="4" />
<column name="name" type="varchar" length="100" jt="12" />
<column name="date_released" type="date" jt="91" />
<column name="dimensions_x" type="decimal" jt="3" />
<column name="dimensions_y" type="decimal" jt="3" />
<column name="dimensions_z" type="decimal" jt="3" />
<fk name="fk_catagory" to_schema="AppEng 2021/22" to_table="Catagory" >
<fk_column name="catagory" pk="id" />
</fk>
</table>
</schema>
<layout name="Default Layout" id="Layout-478" show_relation="columns" >
<entity schema="AppEng 2021/22" name="LegoBrick" color="C1D8EE" x="48" y="80" />
<connector name="MyDb" database="MySql" host="localhost" port="3306" user="root" />
<layout name="Default Layout" id="Layout-de8" confirmed="y" show_relation="columns" >
<entity schema="AppEng 2021/22" name="Brick" color="C1D8EE" x="48" y="80" />
<entity schema="AppEng 2021/22" name="BrickColour" color="C1D8EE" x="320" y="80" />
<entity schema="AppEng 2021/22" name="Catagory" color="C1D8EE" x="336" y="272" />
<entity schema="AppEng 2021/22" name="ColourType" color="C1D8EE" x="560" y="80" />
<entity schema="AppEng 2021/22" name="Set" color="C1D8EE" x="64" y="384" />
<callout x="752" y="48" pointer="Round" >
<comment><![CDATA[Right-click the layout to create entities or shapes, create relations using drag and drop.
Save the design to file. Use the Convert menu option to convert the model to a physical model.]]></comment>
</callout>
<browser id="Browse-1dc0" name="type" confirm_updates="y" confirmed="y" >
<browse_table schema="AppEng 2021/22" entity="BrickColour" x="20" y="20" width="400" height="300" />
</browser>
</layout>
</project>

View File

@@ -0,0 +1,44 @@
CREATE TABLE Catagory (
id integer NOT NULL PRIMARY KEY ,
name varchar(100)
);
CREATE TABLE ColourType (
id integer NOT NULL PRIMARY KEY ,
"type" varchar(64)
);
CREATE TABLE "Set" (
id varchar(20) NOT NULL ,
catagory integer ,
name varchar(100) ,
date_released date ,
dimensions_x decimal ,
dimensions_y decimal ,
dimensions_z decimal ,
FOREIGN KEY ( catagory ) REFERENCES Catagory( id )
);
CREATE TABLE BrickColour (
id integer NOT NULL PRIMARY KEY ,
name varchar(100) ,
hexrgb varchar(6) NOT NULL ,
"type" integer ,
date_from date ,
date_to date ,
FOREIGN KEY ( "type" ) REFERENCES ColourType( id )
);
CREATE TABLE Brick (
id varchar(20) NOT NULL PRIMARY KEY ,
name text(100) NOT NULL ,
colour integer ,
catagory integer ,
weight decimal ,
dimensions_x integer ,
dimensions_y integer ,
dimensions_z integer ,
FOREIGN KEY ( colour ) REFERENCES BrickColour( id ) ,
FOREIGN KEY ( catagory ) REFERENCES Catagory( id )
);