db_schema.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?xml version="1.0"?>
  2. <!--
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  9. xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
  10. <table name="inventory_source" resource="default" engine="innodb">
  11. <column xsi:type="varchar" name="source_code" nullable="false" length="255"/>
  12. <column xsi:type="varchar" name="name" nullable="false" length="255"/>
  13. <column xsi:type="smallint" name="enabled" padding="5" unsigned="true" nullable="false" identity="false"
  14. default="1"/>
  15. <column xsi:type="text" name="description" nullable="true"/>
  16. <column xsi:type="decimal" name="latitude" scale="6" precision="8" unsigned="false" nullable="true"/>
  17. <column xsi:type="decimal" name="longitude" scale="6" precision="9" unsigned="false" nullable="true"/>
  18. <column xsi:type="varchar" name="country_id" nullable="false" length="2"/>
  19. <column xsi:type="int" name="region_id" padding="10" unsigned="true" nullable="true" identity="false"/>
  20. <column xsi:type="varchar" name="region" nullable="true" length="255"/>
  21. <column xsi:type="varchar" name="city" nullable="true" length="255"/>
  22. <column xsi:type="varchar" name="street" nullable="true" length="255"/>
  23. <column xsi:type="varchar" name="postcode" nullable="false" length="255"/>
  24. <column xsi:type="varchar" name="contact_name" nullable="true" length="255"/>
  25. <column xsi:type="varchar" name="email" nullable="true" length="255"/>
  26. <column xsi:type="varchar" name="phone" nullable="true" length="255"/>
  27. <column xsi:type="varchar" name="fax" nullable="true" length="255"/>
  28. <column xsi:type="smallint" name="use_default_carrier_config" padding="5" unsigned="true" nullable="false"
  29. identity="false" default="1"/>
  30. <constraint xsi:type="primary" referenceId="PRIMARY">
  31. <column name="source_code"/>
  32. </constraint>
  33. </table>
  34. <table name="inventory_source_carrier_link" resource="default" engine="innodb">
  35. <column xsi:type="int" name="link_id" padding="10" unsigned="true" nullable="false" identity="true"/>
  36. <column xsi:type="varchar" name="source_code" nullable="false" length="255"/>
  37. <column xsi:type="varchar" name="carrier_code" nullable="false" length="255"/>
  38. <column xsi:type="smallint" name="position" padding="5" unsigned="true" nullable="true" identity="false"/>
  39. <constraint xsi:type="primary" referenceId="PRIMARY">
  40. <column name="link_id"/>
  41. </constraint>
  42. <constraint xsi:type="foreign" referenceId="INV_SOURCE_CARRIER_LNK_SOURCE_CODE_INV_SOURCE_SOURCE_CODE"
  43. table="inventory_source_carrier_link" column="source_code" referenceTable="inventory_source"
  44. referenceColumn="source_code" onDelete="CASCADE"/>
  45. </table>
  46. <table name="inventory_source_item" resource="default" engine="innodb">
  47. <column xsi:type="int" name="source_item_id" padding="10" unsigned="true" nullable="false" identity="true"/>
  48. <column xsi:type="varchar" name="source_code" nullable="false" length="255"/>
  49. <column xsi:type="varchar" name="sku" nullable="false" length="64"/>
  50. <column xsi:type="decimal" name="quantity" scale="4" precision="12" unsigned="false" nullable="false"
  51. default="0"/>
  52. <column xsi:type="smallint" name="status" padding="5" unsigned="true" nullable="false" identity="false"
  53. default="0"/>
  54. <constraint xsi:type="primary" referenceId="PRIMARY">
  55. <column name="source_item_id"/>
  56. </constraint>
  57. <constraint xsi:type="foreign" referenceId="INVENTORY_SOURCE_ITEM_SOURCE_CODE_INVENTORY_SOURCE_SOURCE_CODE"
  58. table="inventory_source_item" column="source_code" referenceTable="inventory_source"
  59. referenceColumn="source_code" onDelete="CASCADE"/>
  60. <constraint xsi:type="unique" referenceId="INVENTORY_SOURCE_ITEM_SOURCE_CODE_SKU">
  61. <column name="source_code"/>
  62. <column name="sku"/>
  63. </constraint>
  64. <index referenceId="INVENTORY_SOURCE_ITEM_SKU_SOURCE_CODE_QUANTITY" indexType="btree">
  65. <column name="sku"/>
  66. <column name="source_code"/>
  67. <column name="quantity"/>
  68. </index>
  69. </table>
  70. <table name="inventory_stock" resource="default" engine="innodb">
  71. <column xsi:type="int" name="stock_id" padding="10" unsigned="true" nullable="false" identity="true"/>
  72. <column xsi:type="varchar" name="name" nullable="false" length="255"/>
  73. <constraint xsi:type="primary" referenceId="PRIMARY">
  74. <column name="stock_id"/>
  75. </constraint>
  76. </table>
  77. <table name="inventory_source_stock_link" resource="default" engine="innodb">
  78. <column xsi:type="int" name="link_id" padding="10" unsigned="true" nullable="false" identity="true"/>
  79. <column xsi:type="int" name="stock_id" padding="10" unsigned="true" nullable="false" identity="false"/>
  80. <column xsi:type="varchar" name="source_code" nullable="false" length="255"/>
  81. <column xsi:type="smallint" name="priority" padding="5" unsigned="true" nullable="false" identity="false"/>
  82. <constraint xsi:type="primary" referenceId="PRIMARY">
  83. <column name="link_id"/>
  84. </constraint>
  85. <constraint xsi:type="foreign" referenceId="INVENTORY_SOURCE_STOCK_LINK_STOCK_ID_INVENTORY_STOCK_STOCK_ID"
  86. table="inventory_source_stock_link" column="stock_id" referenceTable="inventory_stock"
  87. referenceColumn="stock_id" onDelete="CASCADE"/>
  88. <constraint xsi:type="foreign" referenceId="INV_SOURCE_STOCK_LNK_SOURCE_CODE_INV_SOURCE_SOURCE_CODE"
  89. table="inventory_source_stock_link" column="source_code" referenceTable="inventory_source"
  90. referenceColumn="source_code" onDelete="CASCADE"/>
  91. <constraint xsi:type="unique" referenceId="INVENTORY_SOURCE_STOCK_LINK_STOCK_ID_SOURCE_CODE">
  92. <column name="stock_id"/>
  93. <column name="source_code"/>
  94. </constraint>
  95. <index referenceId="INVENTORY_SOURCE_STOCK_LINK_STOCK_ID_PRIORITY" indexType="btree">
  96. <column name="stock_id"/>
  97. <column name="priority"/>
  98. </index>
  99. </table>
  100. </schema>