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


<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&#xa;USER&#xa;----------------&#xa;PK user_id&#xa;name&#xa;email&#xa;phone&#xa;password_hash&#xa;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&#xa;SELLER&#xa;----------------&#xa;PK seller_id&#xa;FK user_id&#xa;store_name&#xa;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&#xa;PRODUCT&#xa;----------------&#xa;PK product_id&#xa;FK seller_id&#xa;FK category_id&#xa;name&#xa;price&#xa;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&#xa;CATEGORY&#xa;----------------&#xa;PK category_id&#xa;name&#xa;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&#xa;ORDER&#xa;----------------&#xa;PK order_id&#xa;FK user_id&#xa;FK delivery_id&#xa;order_date&#xa;status&#xa;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&#xa;ORDER_ITEM&#xa;----------------&#xa;PK order_item_id&#xa;FK order_id&#xa;FK product_id&#xa;quantity&#xa;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&#xa;PAYMENT&#xa;----------------&#xa;PK payment_id&#xa;FK order_id&#xa;amount&#xa;payment_method&#xa;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&#xa;DELIVERY&#xa;----------------&#xa;PK delivery_id&#xa;delivery_address&#xa;delivery_method&#xa;tracking_number&#xa;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&#xa;REVIEW&#xa;----------------&#xa;PK review_id&#xa;FK user_id&#xa;FK product_id&#xa;rating&#xa;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&#xa;CART&#xa;----------------&#xa;PK cart_id&#xa;FK user_id&#xa;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&#xa;CART_ITEM&#xa;----------------&#xa;PK cart_item_id&#xa;FK cart_id&#xa;FK product_id&#xa;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>