Загрузка данных
<mxfile host="app.diagrams.net">
<diagram name="ERD_Marketplace">
<mxGraphModel dx="1600" dy="900" grid="1" gridSize="10" guides="1" tooltips="1"
connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1920"
pageHeight="1080" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<!-- USERS -->
<mxCell id="users" value="USER
----------------
PK user_id
name
email
phone
password_hash
role
created_at"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="60" y="60" width="220" height="180" as="geometry"/>
</mxCell>
<!-- SELLER -->
<mxCell id="seller" value="SELLER
----------------
PK seller_id
FK user_id
store_name
rating
registration_date"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;"
vertex="1" parent="1">
<mxGeometry x="360" y="60" width="220" height="150" as="geometry"/>
</mxCell>
<!-- PRODUCT -->
<mxCell id="product" value="PRODUCT
----------------
PK product_id
FK seller_id
FK category_id
name
description
price
stock_quantity
status"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;"
vertex="1" parent="1">
<mxGeometry x="680" y="40" width="240" height="190" as="geometry"/>
</mxCell>
<!-- CATEGORY -->
<mxCell id="category" value="CATEGORY
----------------
PK category_id
name
description"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;"
vertex="1" parent="1">
<mxGeometry x="980" y="60" width="200" height="120" as="geometry"/>
</mxCell>
<!-- ORDER -->
<mxCell id="order" value="ORDER
----------------
PK order_id
FK user_id
FK delivery_id
order_date
status
total_amount"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;"
vertex="1" parent="1">
<mxGeometry x="60" y="340" width="240" height="160" as="geometry"/>
</mxCell>
<!-- ORDER ITEM -->
<mxCell id="order_item" value="ORDER_ITEM
----------------
PK order_item_id
FK order_id
FK product_id
quantity
price"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;"
vertex="1" parent="1">
<mxGeometry x="380" y="340" width="240" height="150" as="geometry"/>
</mxCell>
<!-- PAYMENT -->
<mxCell id="payment" value="PAYMENT
----------------
PK payment_id
FK order_id
payment_date
amount
payment_method
status"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;"
vertex="1" parent="1">
<mxGeometry x="700" y="340" width="240" height="160" as="geometry"/>
</mxCell>
<!-- DELIVERY -->
<mxCell id="delivery" value="DELIVERY
----------------
PK delivery_id
delivery_address
delivery_method
delivery_cost
tracking_number
delivery_status"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;"
vertex="1" parent="1">
<mxGeometry x="980" y="320" width="250" height="180" as="geometry"/>
</mxCell>
<!-- REVIEW -->
<mxCell id="review" value="REVIEW
----------------
PK review_id
FK user_id
FK product_id
rating
comment
review_date"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;"
vertex="1" parent="1">
<mxGeometry x="360" y="600" width="240" height="160" as="geometry"/>
</mxCell>
<!-- CART -->
<mxCell id="cart" value="CART
----------------
PK cart_id
FK user_id
created_at"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="60" y="620" width="220" height="120" as="geometry"/>
</mxCell>
<!-- CART ITEM -->
<mxCell id="cart_item" value="CART_ITEM
----------------
PK cart_item_id
FK cart_id
FK product_id
quantity"
style="shape=rectangle;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;"
vertex="1" parent="1">
<mxGeometry x="700" y="600" width="240" height="140" as="geometry"/>
</mxCell>
<!-- RELATIONSHIPS -->
<!-- USER - SELLER -->
<mxCell id="rel1" value="1 : 1"
style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;"
edge="1" parent="1" source="users" target="seller">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- SELLER - PRODUCT -->
<mxCell id="rel2" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="seller" target="product">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- CATEGORY - PRODUCT -->
<mxCell id="rel3" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="category" target="product">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- USER - ORDER -->
<mxCell id="rel4" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="users" target="order">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- ORDER - ORDER ITEM -->
<mxCell id="rel5" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="order" target="order_item">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- PRODUCT - ORDER ITEM -->
<mxCell id="rel6" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="product" target="order_item">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- ORDER - PAYMENT -->
<mxCell id="rel7" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="order" target="payment">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- ORDER - DELIVERY -->
<mxCell id="rel8" value="N : 1"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="order" target="delivery">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- USER - REVIEW -->
<mxCell id="rel9" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="users" target="review">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- PRODUCT - REVIEW -->
<mxCell id="rel10" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="product" target="review">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- USER - CART -->
<mxCell id="rel11" value="1 : 1"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="users" target="cart">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- CART - CART ITEM -->
<mxCell id="rel12" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="cart" target="cart_item">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- PRODUCT - CART ITEM -->
<mxCell id="rel13" value="1 : N"
style="edgeStyle=orthogonalEdgeStyle;html=1;"
edge="1" parent="1" source="product" target="cart_item">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>