Skip to content

Instantly share code, notes, and snippets.

@XavM
Created April 20, 2025 05:39
Show Gist options
  • Save XavM/0373e4529142da34c5e63120735df429 to your computer and use it in GitHub Desktop.
Save XavM/0373e4529142da34c5e63120735df429 to your computer and use it in GitHub Desktop.
DB test DrawIO
<mxfile host="app.diagrams.net">
<diagram name="E-commerce DB Schema" id="schema1">
<mxGraphModel dx="800" dy="600" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Users -->
<mxCell id="Users" value="Users&#xa;id (PK)&#xa;name&#xa;email" style="shape=swimlane;childLayout=stackLayout;" vertex="1" parent="1">
<mxGeometry x="40" y="40" width="160" height="120" as="geometry" />
</mxCell>
<!-- Products -->
<mxCell id="Products" value="Products&#xa;id (PK)&#xa;name&#xa;price" style="shape=swimlane;childLayout=stackLayout;" vertex="1" parent="1">
<mxGeometry x="300" y="40" width="160" height="120" as="geometry" />
</mxCell>
<!-- Orders -->
<mxCell id="Orders" value="Orders&#xa;id (PK)&#xa;user_id (FK)&#xa;order_date" style="shape=swimlane;childLayout=stackLayout;" vertex="1" parent="1">
<mxGeometry x="40" y="200" width="160" height="120" as="geometry" />
</mxCell>
<!-- OrderItems -->
<mxCell id="OrderItems" value="OrderItems&#xa;id (PK)&#xa;order_id (FK)&#xa;product_id (FK)&#xa;quantity" style="shape=swimlane;childLayout=stackLayout;" vertex="1" parent="1">
<mxGeometry x="300" y="200" width="180" height="140" as="geometry" />
</mxCell>
<!-- Edges (Relationships) -->
<mxCell id="edge1" style="endArrow=block;" edge="1" source="Orders" target="Users" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="edge2" style="endArrow=block;" edge="1" source="OrderItems" target="Orders" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="edge3" style="endArrow=block;" edge="1" source="OrderItems" target="Products" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment