Add DB diagram to README

This commit is contained in:
Timothy Warren 2019-03-29 12:33:13 -04:00
parent 97da27294d
commit 36743c9055
4 changed files with 199 additions and 3 deletions

View File

@ -8,6 +8,10 @@ else
Q := @ Q := @
endif endif
GRAPH_SRC=$(wildcard design/*.gv)
GRAPH_SVG=$(patsubst %.gv,%.svg,$(GRAPH_SRC))
GRAPH_IMG=$(patsubst %.gv,%.png,$(GRAPH_SRC))
all: $(DEFAULT) all: $(DEFAULT)
@ -24,7 +28,7 @@ help:
$(Q)echo "make examples - Builds examples" $(Q)echo "make examples - Builds examples"
$(Q)echo "make clean - Deletes binaries and documentation. $(Q)echo "make clean - Deletes binaries and documentation.
.PHONY: build run test bench doc examples clean .PHONY: build run test bench doc examples graphs clean
build: build:
$(CARGO) build $(CARGO) build
@ -39,4 +43,9 @@ doc:
$(CARGO) doc $(CARGO) doc
test: test:
$(CARGO) test $(CARGO) test
graphs: $(GRAPH_SVG)
design/%.svg: design/%.gv
dot -Tsvg $^ -o $@

View File

@ -11,4 +11,7 @@ This is an experiment with using Rust to build a CRUD web app.
## Non-Goals ## Non-Goals
* Single-Page App * Single-Page App
* Full interface / Web API separation * Full interface / Web API separation
### DB Design
![DB Design](./design/db.svg)

123
design/db.svg Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %3 Pages: 1 -->
<svg width="664pt" height="390pt"
viewBox="0.00 0.00 664.00 390.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(36 354)">
<title>%3</title>
<polygon fill="#ffffff" stroke="transparent" points="-36,36 -36,-354 628,-354 628,36 -36,36"/>
<!-- media -->
<g id="node1" class="node">
<title>media</title>
<polygon fill="none" stroke="#000000" points="215.5,-80 215.5,-100 304.5,-100 304.5,-80 215.5,-80"/>
<text text-anchor="start" x="242.8965" y="-86.8" font-family="Times,serif" font-weight="bold" font-size="14.00" fill="#000000">media</text>
<polygon fill="none" stroke="#000000" points="215.5,-60 215.5,-80 304.5,-80 304.5,-60 215.5,-60"/>
<text text-anchor="start" x="254.5552" y="-65.8" font-family="Times,serif" font-size="14.00" fill="#000000">id</text>
<polygon fill="none" stroke="#000000" points="215.5,-40 215.5,-60 304.5,-60 304.5,-40 215.5,-40"/>
<text text-anchor="start" x="218.3999" y="-45.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_type_id</text>
<polygon fill="none" stroke="#000000" points="215.5,-20 215.5,-40 304.5,-40 304.5,-20 215.5,-20"/>
<text text-anchor="start" x="221.1206" y="-25.8" font-family="Times,serif" font-size="14.00" fill="#000000">display_name</text>
<polygon fill="none" stroke="#000000" points="215.5,0 215.5,-20 304.5,-20 304.5,0 215.5,0"/>
<text text-anchor="start" x="245.2241" y="-5.8" font-family="Times,serif" font-size="14.00" fill="#000000">notes</text>
</g>
<!-- media_type -->
<g id="node5" class="node">
<title>media_type</title>
<polygon fill="none" stroke="#000000" points=".5,-180 .5,-200 71.5,-200 71.5,-180 .5,-180"/>
<text text-anchor="start" x="3.3447" y="-186.8" font-family="Times,serif" font-weight="bold" font-size="14.00" fill="#000000">media_type</text>
<polygon fill="none" stroke="#000000" points=".5,-160 .5,-180 71.5,-180 71.5,-160 .5,-160"/>
<text text-anchor="start" x="30.5552" y="-165.8" font-family="Times,serif" font-size="14.00" fill="#000000">id</text>
<polygon fill="none" stroke="#000000" points=".5,-140 .5,-160 71.5,-160 71.5,-140 .5,-140"/>
<text text-anchor="start" x="5.2896" y="-145.8" font-family="Times,serif" font-size="14.00" fill="#000000">type_name</text>
<polygon fill="none" stroke="#000000" points=".5,-120 .5,-140 71.5,-140 71.5,-120 .5,-120"/>
<text text-anchor="start" x="4.8965" y="-125.8" font-family="Times,serif" font-size="14.00" fill="#000000">description</text>
</g>
<!-- media&#45;&gt;media_type -->
<g id="edge3" class="edge">
<title>media:media_type_id&#45;&gt;media_type:id</title>
<path fill="none" stroke="#000000" d="M215.5,-50C135.6069,-50 152.7456,-159.9091 81.1911,-169.3544"/>
<polygon fill="#000000" stroke="#000000" points="80.7587,-165.8747 71,-170 81.2013,-172.8606 80.7587,-165.8747"/>
</g>
<!-- media_name -->
<g id="node2" class="node">
<title>media_name</title>
<polygon fill="none" stroke="#000000" points="482,-100 482,-120 559,-120 559,-100 482,-100"/>
<text text-anchor="start" x="484.7378" y="-106.8" font-family="Times,serif" font-weight="bold" font-size="14.00" fill="#000000">media_name</text>
<polygon fill="none" stroke="#000000" points="482,-80 482,-100 559,-100 559,-80 482,-80"/>
<text text-anchor="start" x="515.0552" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">id</text>
<polygon fill="none" stroke="#000000" points="482,-60 482,-80 559,-80 559,-60 482,-60"/>
<text text-anchor="start" x="494.4517" y="-65.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_id</text>
<polygon fill="none" stroke="#000000" points="482,-40 482,-60 559,-60 559,-40 482,-40"/>
<text text-anchor="start" x="505.3413" y="-45.8" font-family="Times,serif" font-size="14.00" fill="#000000">name</text>
<polygon fill="none" stroke="#000000" points="482,-20 482,-40 559,-40 559,-20 482,-20"/>
<text text-anchor="start" x="495.2344" y="-25.8" font-family="Times,serif" font-size="14.00" fill="#000000">language</text>
</g>
<!-- media_name&#45;&gt;media -->
<g id="edge4" class="edge">
<title>media_name:media_id&#45;&gt;media:id</title>
<path fill="none" stroke="#000000" d="M482,-70C406.4427,-70 385.0078,-70 314.313,-70"/>
<polygon fill="#000000" stroke="#000000" points="314,-66.5001 304,-70 314,-73.5001 314,-66.5001"/>
</g>
<!-- media_format -->
<g id="node3" class="node">
<title>media_format</title>
<polygon fill="none" stroke="#000000" points="217.5,-216 217.5,-236 301.5,-236 301.5,-216 217.5,-216"/>
<text text-anchor="start" x="220.2378" y="-222.8" font-family="Times,serif" font-weight="bold" font-size="14.00" fill="#000000">media_format</text>
<polygon fill="none" stroke="#000000" points="217.5,-196 217.5,-216 301.5,-216 301.5,-196 217.5,-196"/>
<text text-anchor="start" x="254.0552" y="-201.8" font-family="Times,serif" font-size="14.00" fill="#000000">id</text>
<polygon fill="none" stroke="#000000" points="217.5,-176 217.5,-196 301.5,-196 301.5,-176 217.5,-176"/>
<text text-anchor="start" x="228.0034" y="-181.8" font-family="Times,serif" font-size="14.00" fill="#000000">is_physical</text>
<polygon fill="none" stroke="#000000" points="217.5,-156 217.5,-176 301.5,-176 301.5,-156 217.5,-156"/>
<text text-anchor="start" x="222.1826" y="-161.8" font-family="Times,serif" font-size="14.00" fill="#000000">format_name</text>
<polygon fill="none" stroke="#000000" points="217.5,-136 217.5,-156 301.5,-156 301.5,-136 217.5,-136"/>
<text text-anchor="start" x="228.3965" y="-141.8" font-family="Times,serif" font-size="14.00" fill="#000000">description</text>
</g>
<!-- media_format_link -->
<g id="node4" class="node">
<title>media_format_link</title>
<polygon fill="none" stroke="#000000" points="464,-200 464,-220 577,-220 577,-200 464,-200"/>
<text text-anchor="start" x="466.8481" y="-206.8" font-family="Times,serif" font-weight="bold" font-size="14.00" fill="#000000">media_format_link</text>
<polygon fill="none" stroke="#000000" points="464,-180 464,-200 577,-200 577,-180 464,-180"/>
<text text-anchor="start" x="478.8999" y="-185.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_type_id</text>
<polygon fill="none" stroke="#000000" points="464,-160 464,-180 577,-180 577,-160 464,-160"/>
<text text-anchor="start" x="472.293" y="-165.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_format_id</text>
</g>
<!-- media_format_link&#45;&gt;media -->
<g id="edge5" class="edge">
<title>media_format_link:media_id&#45;&gt;media:id</title>
<path fill="none" stroke="#000000" d="M464,-190C378.7569,-190 391.61,-79.6419 314.4139,-70.5891"/>
<polygon fill="#000000" stroke="#000000" points="314.1817,-67.0704 304,-70 313.7863,-74.0593 314.1817,-67.0704"/>
</g>
<!-- media_format_link&#45;&gt;media_format -->
<g id="edge6" class="edge">
<title>media_format_link:media_format_id&#45;&gt;media_format:id</title>
<path fill="none" stroke="#000000" d="M464,-170C393.4942,-170 376.9682,-202.7041 311.5231,-205.7701"/>
<polygon fill="#000000" stroke="#000000" points="311.4171,-202.2715 301.5,-206 311.5777,-209.2697 311.4171,-202.2715"/>
</g>
<!-- media_type_format_link -->
<g id="node6" class="node">
<title>media_type_format_link</title>
<polygon fill="none" stroke="#000000" points="448,-298 448,-318 592,-318 592,-298 448,-298"/>
<text text-anchor="start" x="450.7964" y="-304.8" font-family="Times,serif" font-weight="bold" font-size="14.00" fill="#000000">media_type_format_link</text>
<polygon fill="none" stroke="#000000" points="448,-278 448,-298 592,-298 592,-278 448,-278"/>
<text text-anchor="start" x="478.3999" y="-283.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_type_id</text>
<polygon fill="none" stroke="#000000" points="448,-258 448,-278 592,-278 592,-258 448,-258"/>
<text text-anchor="start" x="471.793" y="-263.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_format_id</text>
</g>
<!-- media_type_format_link&#45;&gt;media_format -->
<g id="edge2" class="edge">
<title>media_type_format_link:media_format_id&#45;&gt;media_format:id</title>
<path fill="none" stroke="#000000" d="M448,-268C380.8884,-268 372.8887,-212.137 311.7806,-206.4634"/>
<polygon fill="#000000" stroke="#000000" points="311.6475,-202.9539 301.5,-206 311.3322,-209.9468 311.6475,-202.9539"/>
</g>
<!-- media_type_format_link&#45;&gt;media_type -->
<g id="edge1" class="edge">
<title>media_type_format_link:media_type_id&#45;&gt;media_type:id</title>
<path fill="none" stroke="#000000" d="M448,-288C343.3477,-288 313.7834,-288.5534 215,-254 148.477,-230.731 145.2568,-175.7305 81.3401,-170.4148"/>
<polygon fill="#000000" stroke="#000000" points="81.1323,-166.9038 71,-170 80.8516,-173.8981 81.1323,-166.9038"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: objectTree Pages: 1 -->
<svg width="167pt" height="260pt"
viewBox="0.00 0.00 167.00 260.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 256)">
<title>objectTree</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-256 162.9959,-256 162.9959,4 -4,4"/>
<!-- media_type -->
<g id="node1" class="node">
<title>media_type</title>
<ellipse fill="none" stroke="#000000" cx="55.2871" cy="-234" rx="51.2242" ry="18"/>
<text text-anchor="middle" x="55.2871" y="-229.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_type</text>
</g>
<!-- media -->
<g id="node2" class="node">
<title>media</title>
<ellipse fill="none" stroke="#000000" cx="55.2871" cy="-90" rx="31.9306" ry="18"/>
<text text-anchor="middle" x="55.2871" y="-85.8" font-family="Times,serif" font-size="14.00" fill="#000000">media</text>
</g>
<!-- media_type&#45;&gt;media -->
<g id="edge1" class="edge">
<title>media_type&#45;&gt;media</title>
<path fill="none" stroke="#000000" d="M44.6602,-216.2017C39.187,-205.9924 33.087,-192.7123 30.2871,-180 26.8455,-164.3745 26.8455,-159.6255 30.2871,-144 32.3537,-134.6171 36.2181,-124.9249 40.3014,-116.3864"/>
<polygon fill="#000000" stroke="#000000" points="43.5021,-117.8139 44.9204,-107.3144 37.2641,-114.6378 43.5021,-117.8139"/>
</g>
<!-- media_format -->
<g id="node3" class="node">
<title>media_format</title>
<ellipse fill="none" stroke="#000000" cx="99.2871" cy="-162" rx="59.9184" ry="18"/>
<text text-anchor="middle" x="99.2871" y="-157.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_format</text>
</g>
<!-- media_type&#45;&gt;media_format -->
<g id="edge2" class="edge">
<title>media_type&#45;&gt;media_format</title>
<path fill="none" stroke="#000000" d="M66.1635,-216.2022C71.2405,-207.8944 77.39,-197.8316 83.0054,-188.6427"/>
<polygon fill="#000000" stroke="#000000" points="86.1553,-190.2005 88.3833,-179.8425 80.1823,-186.5503 86.1553,-190.2005"/>
</g>
<!-- media_name -->
<g id="node4" class="node">
<title>media_name</title>
<ellipse fill="none" stroke="#000000" cx="55.2871" cy="-18" rx="55.075" ry="18"/>
<text text-anchor="middle" x="55.2871" y="-13.8" font-family="Times,serif" font-size="14.00" fill="#000000">media_name</text>
</g>
<!-- media&#45;&gt;media_name -->
<g id="edge4" class="edge">
<title>media&#45;&gt;media_name</title>
<path fill="none" stroke="#000000" d="M55.2871,-71.8314C55.2871,-64.131 55.2871,-54.9743 55.2871,-46.4166"/>
<polygon fill="#000000" stroke="#000000" points="58.7872,-46.4132 55.2871,-36.4133 51.7872,-46.4133 58.7872,-46.4132"/>
</g>
<!-- media_format&#45;&gt;media -->
<g id="edge3" class="edge">
<title>media_format&#45;&gt;media</title>
<path fill="none" stroke="#000000" d="M88.4107,-144.2022C83.1651,-135.6186 76.7746,-125.1613 71.0111,-115.7303"/>
<polygon fill="#000000" stroke="#000000" points="73.9364,-113.805 65.7354,-107.0972 67.9634,-117.4551 73.9364,-113.805"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB