Add db diagram script and output

Will update NPM source if PR is accepted & published
This commit is contained in:
Robbie Antenesse 2020-01-25 13:52:55 -07:00
parent b1da2f81c7
commit ae95bf7a0c
4 changed files with 408 additions and 1 deletions

View File

@ -27,6 +27,7 @@
"parcel-plugin-goodie-bag": "^2.0.0",
"rimraf": "^3.0.0",
"sass": "^1.24.0",
"sequelize-erd": "https://github.com/Alamantus/sequelize-erd.git",
"sharp": "^0.23.4"
},
"dependencies": {

View File

@ -0,0 +1,341 @@
<?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: models_diagram Pages: 1 -->
<svg width="1221pt" height="970pt"
viewBox="0.00 0.00 1221.00 970.45" 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 934.4463)">
<title>models_diagram</title>
<polygon fill="#ffffff" stroke="transparent" points="-36,36 -36,-934.4463 1185,-934.4463 1185,36 -36,36"/>
<!-- PermissionLevel -->
<g id="node1" class="node">
<title>PermissionLevel</title>
<polygon fill="#add8e6" stroke="transparent" points="1046.5,-343.5493 1046.5,-365.5493 1141.5,-365.5493 1141.5,-343.5493 1046.5,-343.5493"/>
<polygon fill="none" stroke="#000000" points="1046.5,-343.5493 1046.5,-365.5493 1141.5,-365.5493 1141.5,-343.5493 1046.5,-343.5493"/>
<text text-anchor="start" x="1060.396" y="-351.5493" font-family="Times,serif" font-size="10.00" fill="#000000">PermissionLevel</text>
<polygon fill="none" stroke="#000000" points="1046.5,-321.5493 1046.5,-343.5493 1141.5,-343.5493 1141.5,-321.5493 1046.5,-321.5493"/>
<text text-anchor="start" x="1051.5" y="-329.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="1046.5,-299.5493 1046.5,-321.5493 1141.5,-321.5493 1141.5,-299.5493 1046.5,-299.5493"/>
<text text-anchor="start" x="1051.5" y="-307.5493" font-family="Times,serif" font-size="10.00" fill="#000000">name: STRING</text>
<polygon fill="none" stroke="#000000" points="1046.5,-277.5493 1046.5,-299.5493 1141.5,-299.5493 1141.5,-277.5493 1046.5,-277.5493"/>
<text text-anchor="start" x="1051.092" y="-285.5493" font-family="Times,serif" font-size="10.00" fill="#000000">description: STRING</text>
</g>
<!-- User -->
<g id="node2" class="node">
<title>User</title>
<polygon fill="#add8e6" stroke="transparent" points="770,-633.5493 770,-655.5493 894,-655.5493 894,-633.5493 770,-633.5493"/>
<polygon fill="none" stroke="#000000" points="770,-633.5493 770,-655.5493 894,-655.5493 894,-633.5493 770,-633.5493"/>
<text text-anchor="start" x="822.562" y="-641.5493" font-family="Times,serif" font-size="10.00" fill="#000000">User</text>
<polygon fill="none" stroke="#000000" points="770,-611.5493 770,-633.5493 894,-633.5493 894,-611.5493 770,-611.5493"/>
<text text-anchor="start" x="775" y="-619.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="770,-589.5493 770,-611.5493 894,-611.5493 894,-589.5493 770,-589.5493"/>
<text text-anchor="start" x="775" y="-597.5493" font-family="Times,serif" font-size="10.00" fill="#000000">email: STRING</text>
<polygon fill="none" stroke="#000000" points="770,-567.5493 770,-589.5493 894,-589.5493 894,-567.5493 770,-567.5493"/>
<text text-anchor="start" x="775" y="-575.5493" font-family="Times,serif" font-size="10.00" fill="#000000">username: STRING</text>
<polygon fill="none" stroke="#000000" points="770,-545.5493 770,-567.5493 894,-567.5493 894,-545.5493 770,-545.5493"/>
<text text-anchor="start" x="775" y="-553.5493" font-family="Times,serif" font-size="10.00" fill="#000000">displayName: STRING</text>
<polygon fill="none" stroke="#000000" points="770,-523.5493 770,-545.5493 894,-545.5493 894,-523.5493 770,-523.5493"/>
<text text-anchor="start" x="774.649" y="-531.5493" font-family="Times,serif" font-size="10.00" fill="#000000">permissionLevel: NUMBER</text>
<polygon fill="none" stroke="#000000" points="770,-501.5493 770,-523.5493 894,-523.5493 894,-501.5493 770,-501.5493"/>
<text text-anchor="start" x="775" y="-509.5493" font-family="Times,serif" font-size="10.00" fill="#000000">passwordHash: STRING</text>
<polygon fill="none" stroke="#000000" points="770,-479.5493 770,-501.5493 894,-501.5493 894,-479.5493 770,-479.5493"/>
<text text-anchor="start" x="775" y="-487.5493" font-family="Times,serif" font-size="10.00" fill="#000000">passwordSalt: STRING</text>
<polygon fill="none" stroke="#000000" points="770,-457.5493 770,-479.5493 894,-479.5493 894,-457.5493 770,-457.5493"/>
<text text-anchor="start" x="775" y="-465.5493" font-family="Times,serif" font-size="10.00" fill="#000000">accountConfirm: STRING</text>
<polygon fill="none" stroke="#000000" points="770,-435.5493 770,-457.5493 894,-457.5493 894,-435.5493 770,-435.5493"/>
<text text-anchor="start" x="775" y="-443.5493" font-family="Times,serif" font-size="10.00" fill="#000000">createdAt: DATE</text>
<polygon fill="none" stroke="#000000" points="770,-413.5493 770,-435.5493 894,-435.5493 894,-413.5493 770,-413.5493"/>
<text text-anchor="start" x="775" y="-421.5493" font-family="Times,serif" font-size="10.00" fill="#000000">updatedAt: DATE</text>
</g>
<!-- User&#45;&gt;PermissionLevel -->
<g id="edge2" class="edge">
<title>User&#45;&gt;PermissionLevel</title>
<path fill="none" stroke="#000000" d="M902.0757,-477.4704C945.3096,-442.255 999.9161,-397.7763 1039.7313,-365.3456"/>
<polygon fill="#000000" stroke="#000000" points="902.057,-477.4857 891.4616,-480.3121 898.1803,-480.6434 894.3035,-483.8011 894.3035,-483.8011 894.3035,-483.8011 898.1803,-480.6434 897.1455,-487.2902 902.057,-477.4857 902.057,-477.4857"/>
<ellipse fill="#000000" stroke="#000000" cx="1042.889" cy="-362.7736" rx="4" ry="4"/>
</g>
<!-- Follow -->
<g id="node10" class="node">
<title>Follow</title>
<polygon fill="#add8e6" stroke="transparent" points="1038.5,-600.5493 1038.5,-622.5493 1149.5,-622.5493 1149.5,-600.5493 1038.5,-600.5493"/>
<polygon fill="none" stroke="#000000" points="1038.5,-600.5493 1038.5,-622.5493 1149.5,-622.5493 1149.5,-600.5493 1038.5,-600.5493"/>
<text text-anchor="start" x="1079.832" y="-608.5493" font-family="Times,serif" font-size="10.00" fill="#000000">Follow</text>
<polygon fill="none" stroke="#000000" points="1038.5,-578.5493 1038.5,-600.5493 1149.5,-600.5493 1149.5,-578.5493 1038.5,-578.5493"/>
<text text-anchor="start" x="1043.5" y="-586.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="1038.5,-556.5493 1038.5,-578.5493 1149.5,-578.5493 1149.5,-556.5493 1038.5,-556.5493"/>
<text text-anchor="start" x="1043.5" y="-564.5493" font-family="Times,serif" font-size="10.00" fill="#000000">follower: NUMBER</text>
<polygon fill="none" stroke="#000000" points="1038.5,-534.5493 1038.5,-556.5493 1149.5,-556.5493 1149.5,-534.5493 1038.5,-534.5493"/>
<text text-anchor="start" x="1043.5" y="-542.5493" font-family="Times,serif" font-size="10.00" fill="#000000">followerDomain: TEXT</text>
<polygon fill="none" stroke="#000000" points="1038.5,-512.5493 1038.5,-534.5493 1149.5,-534.5493 1149.5,-512.5493 1038.5,-512.5493"/>
<text text-anchor="start" x="1043.5" y="-520.5493" font-family="Times,serif" font-size="10.00" fill="#000000">following: NUMBER</text>
<polygon fill="none" stroke="#000000" points="1038.5,-490.5493 1038.5,-512.5493 1149.5,-512.5493 1149.5,-490.5493 1038.5,-490.5493"/>
<text text-anchor="start" x="1043.037" y="-498.5493" font-family="Times,serif" font-size="10.00" fill="#000000">followingDomain: TEXT</text>
<polygon fill="none" stroke="#000000" points="1038.5,-468.5493 1038.5,-490.5493 1149.5,-490.5493 1149.5,-468.5493 1038.5,-468.5493"/>
<text text-anchor="start" x="1043.5" y="-476.5493" font-family="Times,serif" font-size="10.00" fill="#000000">createdAt: DATE</text>
<polygon fill="none" stroke="#000000" points="1038.5,-446.5493 1038.5,-468.5493 1149.5,-468.5493 1149.5,-446.5493 1038.5,-446.5493"/>
<text text-anchor="start" x="1043.5" y="-454.5493" font-family="Times,serif" font-size="10.00" fill="#000000">updatedAt: DATE</text>
</g>
<!-- User&#45;&gt;Follow -->
<g id="edge1" class="edge">
<title>User&#45;&gt;Follow</title>
<path fill="none" stroke="#000000" d="M904.5137,-534.5493C943.058,-534.5493 990.0881,-534.5493 1027.5897,-534.5493"/>
<polygon fill="#000000" stroke="#000000" points="904.3035,-534.5494 894.3036,-530.0493 899.3035,-534.5493 894.3035,-534.5493 894.3035,-534.5493 894.3035,-534.5493 899.3035,-534.5493 894.3035,-539.0493 904.3035,-534.5494 904.3035,-534.5494"/>
<polygon fill="#000000" stroke="#000000" points="1027.8995,-534.5494 1037.8995,-539.0493 1032.8995,-534.5493 1037.8995,-534.5493 1037.8995,-534.5493 1037.8995,-534.5493 1032.8995,-534.5493 1037.8994,-530.0493 1027.8995,-534.5494 1027.8995,-534.5494"/>
</g>
<!-- BookReference -->
<g id="node3" class="node">
<title>BookReference</title>
<polygon fill="#add8e6" stroke="transparent" points="785,-801.5493 785,-823.5493 880,-823.5493 880,-801.5493 785,-801.5493"/>
<polygon fill="none" stroke="#000000" points="785,-801.5493 785,-823.5493 880,-823.5493 880,-801.5493 785,-801.5493"/>
<text text-anchor="start" x="801.4045" y="-809.5493" font-family="Times,serif" font-size="10.00" fill="#000000">BookReference</text>
<polygon fill="none" stroke="#000000" points="785,-779.5493 785,-801.5493 880,-801.5493 880,-779.5493 785,-779.5493"/>
<text text-anchor="start" x="790" y="-787.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="785,-757.5493 785,-779.5493 880,-779.5493 880,-757.5493 785,-757.5493"/>
<text text-anchor="start" x="790" y="-765.5493" font-family="Times,serif" font-size="10.00" fill="#000000">name: STRING</text>
<polygon fill="none" stroke="#000000" points="785,-735.5493 785,-757.5493 880,-757.5493 880,-735.5493 785,-735.5493"/>
<text text-anchor="start" x="789.592" y="-743.5493" font-family="Times,serif" font-size="10.00" fill="#000000">description: STRING</text>
<polygon fill="none" stroke="#000000" points="785,-713.5493 785,-735.5493 880,-735.5493 880,-713.5493 785,-713.5493"/>
<text text-anchor="start" x="790" y="-721.5493" font-family="Times,serif" font-size="10.00" fill="#000000">sources: JSON</text>
<polygon fill="none" stroke="#000000" points="785,-691.5493 785,-713.5493 880,-713.5493 880,-691.5493 785,-691.5493"/>
<text text-anchor="start" x="790" y="-699.5493" font-family="Times,serif" font-size="10.00" fill="#000000">covers: JSON</text>
</g>
<!-- Shelf -->
<g id="node4" class="node">
<title>Shelf</title>
<polygon fill="#add8e6" stroke="transparent" points="501,-259.5493 501,-281.5493 625,-281.5493 625,-259.5493 501,-259.5493"/>
<polygon fill="none" stroke="#000000" points="501,-259.5493 501,-281.5493 625,-281.5493 625,-259.5493 501,-259.5493"/>
<text text-anchor="start" x="552.447" y="-267.5493" font-family="Times,serif" font-size="10.00" fill="#000000">Shelf</text>
<polygon fill="none" stroke="#000000" points="501,-237.5493 501,-259.5493 625,-259.5493 625,-237.5493 501,-237.5493"/>
<text text-anchor="start" x="506" y="-245.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="501,-215.5493 501,-237.5493 625,-237.5493 625,-215.5493 501,-215.5493"/>
<text text-anchor="start" x="506" y="-223.5493" font-family="Times,serif" font-size="10.00" fill="#000000">userId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="501,-193.5493 501,-215.5493 625,-215.5493 625,-193.5493 501,-193.5493"/>
<text text-anchor="start" x="506" y="-201.5493" font-family="Times,serif" font-size="10.00" fill="#000000">name: STRING</text>
<polygon fill="none" stroke="#000000" points="501,-171.5493 501,-193.5493 625,-193.5493 625,-171.5493 501,-171.5493"/>
<text text-anchor="start" x="505.649" y="-179.5493" font-family="Times,serif" font-size="10.00" fill="#000000">permissionLevel: NUMBER</text>
<polygon fill="none" stroke="#000000" points="501,-149.5493 501,-171.5493 625,-171.5493 625,-149.5493 501,-149.5493"/>
<text text-anchor="start" x="506" y="-157.5493" font-family="Times,serif" font-size="10.00" fill="#000000">isDeletable: BOOLEAN</text>
<polygon fill="none" stroke="#000000" points="501,-127.5493 501,-149.5493 625,-149.5493 625,-127.5493 501,-127.5493"/>
<text text-anchor="start" x="506" y="-135.5493" font-family="Times,serif" font-size="10.00" fill="#000000">createdAt: DATE</text>
<polygon fill="none" stroke="#000000" points="501,-105.5493 501,-127.5493 625,-127.5493 625,-105.5493 501,-105.5493"/>
<text text-anchor="start" x="506" y="-113.5493" font-family="Times,serif" font-size="10.00" fill="#000000">updatedAt: DATE</text>
</g>
<!-- Shelf&#45;&gt;PermissionLevel -->
<g id="edge4" class="edge">
<title>Shelf&#45;&gt;PermissionLevel</title>
<path fill="none" stroke="#000000" d="M635.2361,-212.9668C674.9372,-223.4941 725.103,-236.5608 770,-247.5493 863.7827,-270.5025 973.4097,-295.1155 1037.9488,-309.3791"/>
<polygon fill="#000000" stroke="#000000" points="635.0425,-212.9155 626.5331,-205.9988 630.2101,-211.6317 625.3777,-210.3479 625.3777,-210.3479 625.3777,-210.3479 630.2101,-211.6317 624.2223,-214.6971 635.0425,-212.9155 635.0425,-212.9155"/>
<ellipse fill="#000000" stroke="#000000" cx="1042.0716" cy="-310.2892" rx="4" ry="4"/>
</g>
<!-- Shelf&#45;&gt;User -->
<g id="edge3" class="edge">
<title>Shelf&#45;&gt;User</title>
<path fill="none" stroke="#000000" d="M631.253,-280.0708C671.7209,-331.3702 722.8529,-396.1881 763.3842,-447.5679"/>
<polygon fill="#000000" stroke="#000000" points="631.2453,-280.061 628.5848,-269.4227 628.1485,-276.1354 625.0518,-272.2098 625.0518,-272.2098 625.0518,-272.2098 628.1485,-276.1354 621.5188,-274.9968 631.2453,-280.061 631.2453,-280.061"/>
<polygon fill="#000000" stroke="#000000" points="760.8536,-450.0111 769.795,-455.6946 766.3494,-445.6757 760.8536,-450.0111"/>
</g>
<!-- ShelfItem -->
<g id="node5" class="node">
<title>ShelfItem</title>
<polygon fill="#add8e6" stroke="transparent" points="268,-801.5493 268,-823.5493 356,-823.5493 356,-801.5493 268,-801.5493"/>
<polygon fill="none" stroke="#000000" points="268,-801.5493 268,-823.5493 356,-823.5493 356,-801.5493 268,-801.5493"/>
<text text-anchor="start" x="292.284" y="-809.5493" font-family="Times,serif" font-size="10.00" fill="#000000">ShelfItem</text>
<polygon fill="none" stroke="#000000" points="268,-779.5493 268,-801.5493 356,-801.5493 356,-779.5493 268,-779.5493"/>
<text text-anchor="start" x="273" y="-787.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="268,-757.5493 268,-779.5493 356,-779.5493 356,-757.5493 268,-757.5493"/>
<text text-anchor="start" x="273" y="-765.5493" font-family="Times,serif" font-size="10.00" fill="#000000">shelfId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="268,-735.5493 268,-757.5493 356,-757.5493 356,-735.5493 268,-735.5493"/>
<text text-anchor="start" x="273" y="-743.5493" font-family="Times,serif" font-size="10.00" fill="#000000">bookId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="268,-713.5493 268,-735.5493 356,-735.5493 356,-713.5493 268,-713.5493"/>
<text text-anchor="start" x="272.6945" y="-721.5493" font-family="Times,serif" font-size="10.00" fill="#000000">bookEdition: JSON</text>
<polygon fill="none" stroke="#000000" points="268,-691.5493 268,-713.5493 356,-713.5493 356,-691.5493 268,-691.5493"/>
<text text-anchor="start" x="273" y="-699.5493" font-family="Times,serif" font-size="10.00" fill="#000000">order: NUMBER</text>
<polygon fill="none" stroke="#000000" points="268,-669.5493 268,-691.5493 356,-691.5493 356,-669.5493 268,-669.5493"/>
<text text-anchor="start" x="273" y="-677.5493" font-family="Times,serif" font-size="10.00" fill="#000000">createdAt: DATE</text>
<polygon fill="none" stroke="#000000" points="268,-647.5493 268,-669.5493 356,-669.5493 356,-647.5493 268,-647.5493"/>
<text text-anchor="start" x="273" y="-655.5493" font-family="Times,serif" font-size="10.00" fill="#000000">updatedAt: DATE</text>
</g>
<!-- ShelfItem&#45;&gt;BookReference -->
<g id="edge6" class="edge">
<title>ShelfItem&#45;&gt;BookReference</title>
<path fill="none" stroke="#000000" d="M363.4373,-792.7069C398.178,-826.8494 447.2021,-867.0673 500,-885.5493 552.8552,-904.0514 572.1499,-900.9169 626,-885.5493 682.2641,-869.4928 738.1439,-833.1526 777.4783,-803.2804"/>
<polygon fill="#000000" stroke="#000000" points="363.3203,-792.5901 359.4246,-782.3395 359.7825,-789.0568 356.2446,-785.5235 356.2446,-785.5235 356.2446,-785.5235 359.7825,-789.0568 353.0647,-788.7076 363.3203,-792.5901 363.3203,-792.5901"/>
<ellipse fill="#000000" stroke="#000000" cx="780.9637" cy="-800.603" rx="4" ry="4"/>
</g>
<!-- ShelfItem&#45;&gt;Shelf -->
<g id="edge5" class="edge">
<title>ShelfItem&#45;&gt;Shelf</title>
<path fill="none" stroke="#000000" d="M349.9134,-637.8387C385.614,-548.3713 442.1201,-413.0226 500,-299.5493 501.5077,-296.5934 503.0638,-293.6069 504.6569,-290.6043"/>
<polygon fill="#000000" stroke="#000000" points="349.9006,-637.8709 342.0212,-645.4975 348.0514,-642.5164 346.2021,-647.1618 346.2021,-647.1618 346.2021,-647.1618 348.0514,-642.5164 350.3831,-648.8262 349.9006,-637.8709 349.9006,-637.8709"/>
<polygon fill="#000000" stroke="#000000" points="507.8672,-292.0252 509.5358,-281.5626 501.7068,-288.7011 507.8672,-292.0252"/>
</g>
<!-- Status -->
<g id="node6" class="node">
<title>Status</title>
<polygon fill="#add8e6" stroke="transparent" points="0,-398.5493 0,-420.5493 124,-420.5493 124,-398.5493 0,-398.5493"/>
<polygon fill="none" stroke="#000000" points="0,-398.5493 0,-420.5493 124,-420.5493 124,-398.5493 0,-398.5493"/>
<text text-anchor="start" x="49.7775" y="-406.5493" font-family="Times,serif" font-size="10.00" fill="#000000">Status</text>
<polygon fill="none" stroke="#000000" points="0,-376.5493 0,-398.5493 124,-398.5493 124,-376.5493 0,-376.5493"/>
<text text-anchor="start" x="5" y="-384.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="0,-354.5493 0,-376.5493 124,-376.5493 124,-354.5493 0,-354.5493"/>
<text text-anchor="start" x="5" y="-362.5493" font-family="Times,serif" font-size="10.00" fill="#000000">userId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="0,-332.5493 0,-354.5493 124,-354.5493 124,-332.5493 0,-332.5493"/>
<text text-anchor="start" x="4.649" y="-340.5493" font-family="Times,serif" font-size="10.00" fill="#000000">permissionLevel: NUMBER</text>
<polygon fill="none" stroke="#000000" points="0,-310.5493 0,-332.5493 124,-332.5493 124,-310.5493 0,-310.5493"/>
<text text-anchor="start" x="5" y="-318.5493" font-family="Times,serif" font-size="10.00" fill="#000000">text: TEXT</text>
<polygon fill="none" stroke="#000000" points="0,-288.5493 0,-310.5493 124,-310.5493 124,-288.5493 0,-288.5493"/>
<text text-anchor="start" x="5" y="-296.5493" font-family="Times,serif" font-size="10.00" fill="#000000">shelfItemId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="0,-266.5493 0,-288.5493 124,-288.5493 124,-266.5493 0,-266.5493"/>
<text text-anchor="start" x="5" y="-274.5493" font-family="Times,serif" font-size="10.00" fill="#000000">progress: NUMBER</text>
<polygon fill="none" stroke="#000000" points="0,-244.5493 0,-266.5493 124,-266.5493 124,-244.5493 0,-244.5493"/>
<text text-anchor="start" x="5" y="-252.5493" font-family="Times,serif" font-size="10.00" fill="#000000">createdAt: DATE</text>
<polygon fill="none" stroke="#000000" points="0,-222.5493 0,-244.5493 124,-244.5493 124,-222.5493 0,-222.5493"/>
<text text-anchor="start" x="5" y="-230.5493" font-family="Times,serif" font-size="10.00" fill="#000000">updatedAt: DATE</text>
</g>
<!-- Status&#45;&gt;PermissionLevel -->
<g id="edge8" class="edge">
<title>Status&#45;&gt;PermissionLevel</title>
<path fill="none" stroke="#000000" d="M131.2621,-241.0549C168.2967,-202.5683 216.7627,-158.8328 268,-130.5493 468.5624,-19.8367 542.0647,-36.529 770,-13.5493 824.8332,-8.0212 845.583,12.7761 894,-13.5493 994.311,-68.0905 1051.9476,-197.2189 1077.4974,-269.7698"/>
<polygon fill="#000000" stroke="#000000" points="130.9036,-241.4317 120.7502,-245.5741 127.4569,-245.0539 124.0102,-248.6761 124.0102,-248.6761 124.0102,-248.6761 127.4569,-245.0539 127.2702,-251.7782 130.9036,-241.4317 130.9036,-241.4317"/>
<ellipse fill="#000000" stroke="#000000" cx="1078.8543" cy="-273.6889" rx="4" ry="4"/>
</g>
<!-- Status&#45;&gt;User -->
<g id="edge7" class="edge">
<title>Status&#45;&gt;User</title>
<path fill="none" stroke="#000000" d="M132.6242,-373.5377C215.6401,-431.1253 359.9189,-520.4761 500,-555.5493 587.3942,-577.4308 691.5539,-564.8483 759.5976,-551.678"/>
<polygon fill="#000000" stroke="#000000" points="132.4903,-373.4443 126.8663,-364.0304 128.3904,-370.5823 124.2905,-367.7204 124.2905,-367.7204 124.2905,-367.7204 128.3904,-370.5823 121.7147,-371.4103 132.4903,-373.4443 132.4903,-373.4443"/>
<polygon fill="#000000" stroke="#000000" points="760.66,-555.0352 769.7839,-549.6497 759.2929,-548.17 760.66,-555.0352"/>
</g>
<!-- Status&#45;&gt;ShelfItem -->
<g id="edge9" class="edge">
<title>Status&#45;&gt;ShelfItem</title>
<path fill="none" stroke="#000000" d="M127.215,-429.5454C169.5126,-499.5902 223.7567,-589.4184 262.512,-653.5972"/>
<polygon fill="#000000" stroke="#000000" points="127.0505,-429.2729 125.7334,-418.3864 124.4659,-424.9928 121.8812,-420.7126 121.8812,-420.7126 121.8812,-420.7126 124.4659,-424.9928 118.0291,-423.0388 127.0505,-429.2729 127.0505,-429.2729"/>
<polygon fill="#000000" stroke="#000000" points="259.7095,-655.7271 267.8749,-662.4781 265.7017,-652.1085 259.7095,-655.7271"/>
</g>
<!-- Reaction -->
<g id="node9" class="node">
<title>Reaction</title>
<polygon fill="#add8e6" stroke="transparent" points="784,-207.5493 784,-229.5493 881,-229.5493 881,-207.5493 784,-207.5493"/>
<polygon fill="none" stroke="#000000" points="784,-207.5493 784,-229.5493 881,-229.5493 881,-207.5493 784,-207.5493"/>
<text text-anchor="start" x="814.728" y="-215.5493" font-family="Times,serif" font-size="10.00" fill="#000000">Reaction</text>
<polygon fill="none" stroke="#000000" points="784,-185.5493 784,-207.5493 881,-207.5493 881,-185.5493 784,-185.5493"/>
<text text-anchor="start" x="789" y="-193.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="784,-163.5493 784,-185.5493 881,-185.5493 881,-163.5493 784,-163.5493"/>
<text text-anchor="start" x="789" y="-171.5493" font-family="Times,serif" font-size="10.00" fill="#000000">userId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="784,-141.5493 784,-163.5493 881,-163.5493 881,-141.5493 784,-141.5493"/>
<text text-anchor="start" x="789" y="-149.5493" font-family="Times,serif" font-size="10.00" fill="#000000">targetType: ENUM</text>
<polygon fill="none" stroke="#000000" points="784,-119.5493 784,-141.5493 881,-141.5493 881,-119.5493 784,-119.5493"/>
<text text-anchor="start" x="789" y="-127.5493" font-family="Times,serif" font-size="10.00" fill="#000000">targetId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="784,-97.5493 784,-119.5493 881,-119.5493 881,-97.5493 784,-97.5493"/>
<text text-anchor="start" x="788.7665" y="-105.5493" font-family="Times,serif" font-size="10.00" fill="#000000">reactionType: ENUM</text>
<polygon fill="none" stroke="#000000" points="784,-75.5493 784,-97.5493 881,-97.5493 881,-75.5493 784,-75.5493"/>
<text text-anchor="start" x="789" y="-83.5493" font-family="Times,serif" font-size="10.00" fill="#000000">reaction: TEXT</text>
<polygon fill="none" stroke="#000000" points="784,-53.5493 784,-75.5493 881,-75.5493 881,-53.5493 784,-53.5493"/>
<text text-anchor="start" x="789" y="-61.5493" font-family="Times,serif" font-size="10.00" fill="#000000">createdAt: DATE</text>
<polygon fill="none" stroke="#000000" points="784,-31.5493 784,-53.5493 881,-53.5493 881,-31.5493 784,-31.5493"/>
<text text-anchor="start" x="789" y="-39.5493" font-family="Times,serif" font-size="10.00" fill="#000000">updatedAt: DATE</text>
</g>
<!-- Status&#45;&gt;Reaction -->
<g id="edge15" class="edge">
<title>Status&#45;&gt;Reaction</title>
<path fill="none" stroke="#000000" d="M132.6242,-269.5609C215.6401,-211.9733 359.9189,-122.6225 500,-87.5493 593.9814,-64.0185 706.3361,-89.3631 773.2898,-109.91"/>
<polygon fill="#000000" stroke="#000000" points="130.487,-266.7844 124.2905,-275.3782 134.4937,-272.5242 130.487,-266.7844"/>
<polygon fill="#000000" stroke="#000000" points="773.6918,-110.036 781.8865,-117.3228 778.4626,-111.5326 783.2334,-113.0291 783.2334,-113.0291 783.2334,-113.0291 778.4626,-111.5326 784.5803,-108.7354 773.6918,-110.036 773.6918,-110.036"/>
</g>
<!-- Review -->
<g id="node7" class="node">
<title>Review</title>
<polygon fill="#add8e6" stroke="transparent" points="500,-515.5493 500,-537.5493 626,-537.5493 626,-515.5493 500,-515.5493"/>
<polygon fill="none" stroke="#000000" points="500,-515.5493 500,-537.5493 626,-537.5493 626,-515.5493 500,-515.5493"/>
<text text-anchor="start" x="547.7275" y="-523.5493" font-family="Times,serif" font-size="10.00" fill="#000000">Review</text>
<polygon fill="none" stroke="#000000" points="500,-493.5493 500,-515.5493 626,-515.5493 626,-493.5493 500,-493.5493"/>
<text text-anchor="start" x="505" y="-501.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="500,-471.5493 500,-493.5493 626,-493.5493 626,-471.5493 500,-471.5493"/>
<text text-anchor="start" x="505" y="-479.5493" font-family="Times,serif" font-size="10.00" fill="#000000">userId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="500,-449.5493 500,-471.5493 626,-471.5493 626,-449.5493 500,-449.5493"/>
<text text-anchor="start" x="505" y="-457.5493" font-family="Times,serif" font-size="10.00" fill="#000000">permissionLevel: NUMBER</text>
<polygon fill="none" stroke="#000000" points="500,-427.5493 500,-449.5493 626,-449.5493 626,-427.5493 500,-427.5493"/>
<text text-anchor="start" x="505" y="-435.5493" font-family="Times,serif" font-size="10.00" fill="#000000">text: TEXT</text>
<polygon fill="none" stroke="#000000" points="500,-405.5493 500,-427.5493 626,-427.5493 626,-405.5493 500,-405.5493"/>
<text text-anchor="start" x="504.548" y="-413.5493" font-family="Times,serif" font-size="10.00" fill="#000000">bookReferenceId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="500,-383.5493 500,-405.5493 626,-405.5493 626,-383.5493 500,-383.5493"/>
<text text-anchor="start" x="505" y="-391.5493" font-family="Times,serif" font-size="10.00" fill="#000000">bookEdition: JSON</text>
<polygon fill="none" stroke="#000000" points="500,-361.5493 500,-383.5493 626,-383.5493 626,-361.5493 500,-361.5493"/>
<text text-anchor="start" x="505" y="-369.5493" font-family="Times,serif" font-size="10.00" fill="#000000">rating: NUMBER</text>
<polygon fill="none" stroke="#000000" points="500,-339.5493 500,-361.5493 626,-361.5493 626,-339.5493 500,-339.5493"/>
<text text-anchor="start" x="505" y="-347.5493" font-family="Times,serif" font-size="10.00" fill="#000000">createdAt: DATE</text>
<polygon fill="none" stroke="#000000" points="500,-317.5493 500,-339.5493 626,-339.5493 626,-317.5493 500,-317.5493"/>
<text text-anchor="start" x="505" y="-325.5493" font-family="Times,serif" font-size="10.00" fill="#000000">updatedAt: DATE</text>
</g>
<!-- Review&#45;&gt;PermissionLevel -->
<g id="edge11" class="edge">
<title>Review&#45;&gt;PermissionLevel</title>
<path fill="none" stroke="#000000" d="M636.2623,-412.9106C743.727,-391.438 941.7507,-351.8706 1038.0311,-332.6326"/>
<polygon fill="#000000" stroke="#000000" points="636.0071,-412.9616 625.3192,-410.5082 631.104,-413.9413 626.2009,-414.921 626.2009,-414.921 626.2009,-414.921 631.104,-413.9413 627.0827,-419.3338 636.0071,-412.9616 636.0071,-412.9616"/>
<ellipse fill="#000000" stroke="#000000" cx="1041.9832" cy="-331.843" rx="4" ry="4"/>
</g>
<!-- Review&#45;&gt;User -->
<g id="edge10" class="edge">
<title>Review&#45;&gt;User</title>
<path fill="none" stroke="#000000" d="M635.4045,-456.3496C674.0972,-471.7404 721.5743,-490.6253 760.1783,-505.9808"/>
<polygon fill="#000000" stroke="#000000" points="635.3605,-456.3321 627.7318,-448.4547 630.7145,-454.4841 626.0685,-452.636 626.0685,-452.636 626.0685,-452.636 630.7145,-454.4841 624.4053,-456.8174 635.3605,-456.3321 635.3605,-456.3321"/>
<polygon fill="#000000" stroke="#000000" points="759.2055,-509.3605 769.791,-509.8045 761.7927,-502.8562 759.2055,-509.3605"/>
</g>
<!-- Review&#45;&gt;BookReference -->
<g id="edge12" class="edge">
<title>Review&#45;&gt;BookReference</title>
<path fill="none" stroke="#000000" d="M632.4075,-512.696C677.7156,-568.2785 736.0098,-639.7917 777.8846,-691.1624"/>
<polygon fill="#000000" stroke="#000000" points="632.3869,-512.6707 629.5565,-502.0764 629.2277,-508.7952 626.0685,-504.9196 626.0685,-504.9196 626.0685,-504.9196 629.2277,-508.7952 622.5806,-507.7629 632.3869,-512.6707 632.3869,-512.6707"/>
<polygon fill="#000000" stroke="#000000" points="775.4286,-693.689 784.4598,-699.2286 780.8544,-689.2661 775.4286,-693.689"/>
</g>
<!-- Review&#45;&gt;Reaction -->
<g id="edge16" class="edge">
<title>Review&#45;&gt;Reaction</title>
<path fill="none" stroke="#000000" d="M632.9251,-350.3458C677.6193,-300.9994 734.7869,-237.8813 776.3849,-191.9533"/>
<polygon fill="#000000" stroke="#000000" points="630.1875,-348.1546 626.0685,-357.916 635.3758,-352.8537 630.1875,-348.1546"/>
<polygon fill="#000000" stroke="#000000" points="776.4695,-191.8599 786.5179,-187.469 779.826,-188.154 783.1826,-184.4481 783.1826,-184.4481 783.1826,-184.4481 779.826,-188.154 779.8473,-181.4272 776.4695,-191.8599 776.4695,-191.8599"/>
</g>
<!-- Recommendation -->
<g id="node8" class="node">
<title>Recommendation</title>
<polygon fill="#add8e6" stroke="transparent" points="515,-845.5493 515,-867.5493 611,-867.5493 611,-845.5493 515,-845.5493"/>
<polygon fill="none" stroke="#000000" points="515,-845.5493 515,-867.5493 611,-867.5493 611,-845.5493 515,-845.5493"/>
<text text-anchor="start" x="527.7295" y="-853.5493" font-family="Times,serif" font-size="10.00" fill="#000000">Recommendation</text>
<polygon fill="none" stroke="#000000" points="515,-823.5493 515,-845.5493 611,-845.5493 611,-823.5493 515,-823.5493"/>
<text text-anchor="start" x="520" y="-831.5493" font-family="Times,serif" font-size="10.00" fill="#000000">id: NUMBER</text>
<polygon fill="none" stroke="#000000" points="515,-801.5493 515,-823.5493 611,-823.5493 611,-801.5493 515,-801.5493"/>
<text text-anchor="start" x="519.817" y="-809.5493" font-family="Times,serif" font-size="10.00" fill="#000000">fromUser: NUMBER</text>
<polygon fill="none" stroke="#000000" points="515,-779.5493 515,-801.5493 611,-801.5493 611,-779.5493 515,-779.5493"/>
<text text-anchor="start" x="520" y="-787.5493" font-family="Times,serif" font-size="10.00" fill="#000000">toUser: NUMBER</text>
<polygon fill="none" stroke="#000000" points="515,-757.5493 515,-779.5493 611,-779.5493 611,-757.5493 515,-757.5493"/>
<text text-anchor="start" x="520" y="-765.5493" font-family="Times,serif" font-size="10.00" fill="#000000">text: TEXT</text>
<polygon fill="none" stroke="#000000" points="515,-735.5493 515,-757.5493 611,-757.5493 611,-735.5493 515,-735.5493"/>
<text text-anchor="start" x="520" y="-743.5493" font-family="Times,serif" font-size="10.00" fill="#000000">bookId: NUMBER</text>
<polygon fill="none" stroke="#000000" points="515,-713.5493 515,-735.5493 611,-735.5493 611,-713.5493 515,-713.5493"/>
<text text-anchor="start" x="520" y="-721.5493" font-family="Times,serif" font-size="10.00" fill="#000000">data: JSON</text>
<polygon fill="none" stroke="#000000" points="515,-691.5493 515,-713.5493 611,-713.5493 611,-691.5493 515,-691.5493"/>
<text text-anchor="start" x="520" y="-699.5493" font-family="Times,serif" font-size="10.00" fill="#000000">createdAt: DATE</text>
<polygon fill="none" stroke="#000000" points="515,-669.5493 515,-691.5493 611,-691.5493 611,-669.5493 515,-669.5493"/>
<text text-anchor="start" x="520" y="-677.5493" font-family="Times,serif" font-size="10.00" fill="#000000">updatedAt: DATE</text>
<polygon fill="none" stroke="#000000" points="515,-647.5493 515,-669.5493 611,-669.5493 611,-647.5493 515,-647.5493"/>
<text text-anchor="start" x="520" y="-655.5493" font-family="Times,serif" font-size="10.00" fill="#000000">deletedAt: DATE</text>
</g>
<!-- Recommendation&#45;&gt;User -->
<g id="edge13" class="edge">
<title>Recommendation&#45;&gt;User</title>
<path fill="none" stroke="#000000" d="M618.8171,-711.2771C660.2937,-676.8932 717.1669,-629.7455 761.7389,-592.7955"/>
<polygon fill="#000000" stroke="#000000" points="618.7904,-711.2992 608.2198,-714.217 614.9411,-714.4903 611.0918,-717.6814 611.0918,-717.6814 611.0918,-717.6814 614.9411,-714.4903 613.9638,-721.1457 618.7904,-711.2992 618.7904,-711.2992"/>
<polygon fill="#000000" stroke="#000000" points="764.1635,-595.3318 769.6284,-586.2551 759.696,-589.9428 764.1635,-595.3318"/>
</g>
<!-- Recommendation&#45;&gt;BookReference -->
<g id="edge14" class="edge">
<title>Recommendation&#45;&gt;BookReference</title>
<path fill="none" stroke="#000000" d="M621.1811,-757.5493C667.1011,-757.5493 730.7605,-757.5493 776.0835,-757.5493"/>
<polygon fill="#000000" stroke="#000000" points="621.0918,-757.5494 611.0919,-753.0493 616.0918,-757.5493 611.0918,-757.5493 611.0918,-757.5493 611.0918,-757.5493 616.0918,-757.5493 611.0918,-762.0493 621.0918,-757.5494 621.0918,-757.5494"/>
<ellipse fill="#000000" stroke="#000000" cx="780.3245" cy="-757.5493" rx="4" ry="4"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -0,0 +1,59 @@
// Run with `node ./path/to/server/sequelize/generate-db-diagram.js`
(async function(){
const path = require('path');
const {writeFileSync} = require('fs');
const Sequelize = require('sequelize');
const sequelizeErd = require('sequelize-erd');
let siteConfig;
try {
siteConfig = require('../config.json');
} catch (ex) {
console.error('Please copy `config.example.json` to `config.json` and fill it with your server\'s data.');
process.exit(1);
}
const sequelizeConfig = {
dialect: siteConfig.db_engine,
};
switch (siteConfig.db_engine) {
case 'sqlite': {
sequelizeConfig.storage = typeof siteConfig.sqlite_location !== 'undefined'
? (
siteConfig.sqlite_location.substr(0, 1) === '.' // If relative path, make relative to ./server
? path.resolve('../server/', siteConfig.sqlite_location)
: path.resolve(siteConfig.sqlite_location)
)
: path.resolve(__dirname, '../server/database.sqlite');
break;
}
default: {
sequelizeConfig.host = siteConfig.db_host;
sequelizeConfig.port = siteConfig.db_port;
sequelizeConfig.database = siteConfig.db_database;
sequelizeConfig.username = siteConfig.db_username;
sequelizeConfig.password = siteConfig.db_password;
}
}
const sequelize = new Sequelize(sequelizeConfig);
require('./models')(sequelize);
try {
const svg = await sequelizeErd({
source: sequelize,
engine: 'dot',
arrowShapes: {
BelongsToMany: ['crow', 'crow'],
BelongsTo: ['crow', 'dot'],
HasMany: ['normal', 'crow'],
HasOne: ['dot', 'dot'],
},
arrowSize: 1,
lineWidth: 1,
});
writeFileSync(path.resolve(__dirname, './db-diagram.svg'), svg);
} catch (err) { console.error(err) }
// Writes erd.svg to local path with SVG file from your Sequelize models
})()

View File

@ -1684,7 +1684,7 @@ command-exists@^1.2.6:
resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.8.tgz#715acefdd1223b9c9b37110a149c6392c2852291"
integrity sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw==
commander@^2.11.0, commander@^2.19.0, commander@^2.20.0:
commander@^2.11.0, commander@^2.19.0, commander@^2.20.0, commander@^2.9.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
@ -6295,6 +6295,12 @@ seq-queue@^0.0.5:
resolved "https://registry.yarnpkg.com/seq-queue/-/seq-queue-0.0.5.tgz#d56812e1c017a6e4e7c3e3a37a1da6d78dd3c93e"
integrity sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=
"sequelize-erd@https://github.com/Alamantus/sequelize-erd.git":
version "1.3.0"
resolved "https://github.com/Alamantus/sequelize-erd.git#c2def788e60e5976a96779ceb033da1c99ed97fa"
dependencies:
commander "^2.9.0"
sequelize-pool@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/sequelize-pool/-/sequelize-pool-2.3.0.tgz#64f1fe8744228172c474f530604b6133be64993d"