Загрузка данных
<mxfile host="app.diagrams.net">
<diagram name="ERD_Marketplace">
<mxGraphModel dx="1422" dy="794" grid="1" gridSize="10" guides="1"
tooltips="1" connect="1" arrows="1" fold="1" page="1"
pageScale="1" pageWidth="1600" pageHeight="1200">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<!-- USERS -->
<mxCell id="u1"
value="Table1
USER
----------------
PK user_id
name
email
phone
password_hash
role"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;columnLines=0;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="40" y="40" width="220" height="190" as="geometry"/>
</mxCell>
<!-- SELLER -->
<mxCell id="u2"
value="Table1
SELLER
----------------
PK seller_id
FK user_id
store_name
rating"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;"
vertex="1" parent="1">
<mxGeometry x="340" y="40" width="220" height="160" as="geometry"/>
</mxCell>
<!-- PRODUCT -->
<mxCell id="u3"
value="Table1
PRODUCT
----------------
PK product_id
FK seller_id
FK category_id
name
price
stock_quantity"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#d5e8d4;strokeColor=#82b366;"
vertex="1" parent="1">
<mxGeometry x="650" y="40" width="240" height="190" as="geometry"/>
</mxCell>
<!-- CATEGORY -->
<mxCell id="u4"
value="Table1
CATEGORY
----------------
PK category_id
name
description"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#f8cecc;strokeColor=#b85450;"
vertex="1" parent="1">
<mxGeometry x="980" y="40" width="220" height="140" as="geometry"/>
</mxCell>
<!-- ORDER -->
<mxCell id="u5"
value="Table1
ORDER
----------------
PK order_id
FK user_id
FK delivery_id
order_date
status
total_amount"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#fff2cc;strokeColor=#d6b656;"
vertex="1" parent="1">
<mxGeometry x="40" y="340" width="240" height="190" as="geometry"/>
</mxCell>
<!-- ORDER ITEM -->
<mxCell id="u6"
value="Table1
ORDER_ITEM
----------------
PK order_item_id
FK order_id
FK product_id
quantity
price"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;"
vertex="1" parent="1">
<mxGeometry x="370" y="340" width="240" height="180" as="geometry"/>
</mxCell>
<!-- PAYMENT -->
<mxCell id="u7"
value="Table1
PAYMENT
----------------
PK payment_id
FK order_id
amount
payment_method
status"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#d5e8d4;strokeColor=#82b366;"
vertex="1" parent="1">
<mxGeometry x="700" y="340" width="240" height="180" as="geometry"/>
</mxCell>
<!-- DELIVERY -->
<mxCell id="u8"
value="Table1
DELIVERY
----------------
PK delivery_id
delivery_address
delivery_method
tracking_number
delivery_status"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#f5f5f5;strokeColor=#666666;"
vertex="1" parent="1">
<mxGeometry x="1020" y="340" width="260" height="190" as="geometry"/>
</mxCell>
<!-- REVIEW -->
<mxCell id="u9"
value="Table1
REVIEW
----------------
PK review_id
FK user_id
FK product_id
rating
comment"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;"
vertex="1" parent="1">
<mxGeometry x="360" y="650" width="240" height="170" as="geometry"/>
</mxCell>
<!-- CART -->
<mxCell id="u10"
value="Table1
CART
----------------
PK cart_id
FK user_id
created_at"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"
vertex="1" parent="1">
<mxGeometry x="40" y="660" width="220" height="140" as="geometry"/>
</mxCell>
<!-- CART ITEM -->
<mxCell id="u11"
value="Table1
CART_ITEM
----------------
PK cart_item_id
FK cart_id
FK product_id
quantity"
style="shape=table;startSize=30;container=1;childLayout=tableLayout;fixedRows=1;rowLines=1;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;"
vertex="1" parent="1">
<mxGeometry x="720" y="650" width="240" height="160" as="geometry"/>
</mxCell>
<!-- RELATIONS -->
<!-- USER 1 TO MANY ORDER -->
<mxCell id="r1" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u1" target="u5">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- USER 1 TO 1 SELLER -->
<mxCell id="r2" value="1 to 1"
style="endArrow=ERone;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u1" target="u2">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- SELLER 1 TO MANY PRODUCT -->
<mxCell id="r3" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u2" target="u3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- CATEGORY 1 TO MANY PRODUCT -->
<mxCell id="r4" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u4" target="u3">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- ORDER MANY TO MANY PRODUCT via ORDER_ITEM -->
<mxCell id="r5" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u5" target="u6">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="r6" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u3" target="u6">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- ORDER 1 TO MANY PAYMENT -->
<mxCell id="r7" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u5" target="u7">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- DELIVERY 1 TO MANY ORDER -->
<mxCell id="r8" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u8" target="u5">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- USER 1 TO MANY REVIEW -->
<mxCell id="r9" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u1" target="u9">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- PRODUCT 1 TO MANY REVIEW -->
<mxCell id="r10" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u3" target="u9">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- USER 1 TO 1 CART -->
<mxCell id="r11" value="1 to 1"
style="endArrow=ERone;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u1" target="u10">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<!-- CART MANY TO MANY PRODUCT via CART_ITEM -->
<mxCell id="r12" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u10" target="u11">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="r13" value="1 to many"
style="endArrow=ERmany;startArrow=ERone;html=1;strokeWidth=2;"
edge="1" parent="1" source="u3" target="u11">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>