Загрузка данных


<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&#xa;----------------&#xa;PK user_id&#xa;name&#xa;email&#xa;phone&#xa;password_hash&#xa;role&#xa;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&#xa;----------------&#xa;PK seller_id&#xa;FK user_id&#xa;store_name&#xa;rating&#xa;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&#xa;----------------&#xa;PK product_id&#xa;FK seller_id&#xa;FK category_id&#xa;name&#xa;description&#xa;price&#xa;stock_quantity&#xa;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&#xa;----------------&#xa;PK category_id&#xa;name&#xa;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&#xa;----------------&#xa;PK order_id&#xa;FK user_id&#xa;FK delivery_id&#xa;order_date&#xa;status&#xa;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&#xa;----------------&#xa;PK order_item_id&#xa;FK order_id&#xa;FK product_id&#xa;quantity&#xa;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&#xa;----------------&#xa;PK payment_id&#xa;FK order_id&#xa;payment_date&#xa;amount&#xa;payment_method&#xa;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&#xa;----------------&#xa;PK delivery_id&#xa;delivery_address&#xa;delivery_method&#xa;delivery_cost&#xa;tracking_number&#xa;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&#xa;----------------&#xa;PK review_id&#xa;FK user_id&#xa;FK product_id&#xa;rating&#xa;comment&#xa;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&#xa;----------------&#xa;PK cart_id&#xa;FK user_id&#xa;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&#xa;----------------&#xa;PK cart_item_id&#xa;FK cart_id&#xa;FK product_id&#xa;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>