db_schema.xml 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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="store_website" resource="default" engine="innodb" comment="Websites">
  11. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="true"
  12. comment="Website Id"/>
  13. <column xsi:type="varchar" name="code" nullable="true" length="32" comment="Code"/>
  14. <column xsi:type="varchar" name="name" nullable="true" length="64" comment="Website Name"/>
  15. <column xsi:type="smallint" name="sort_order" padding="5" unsigned="true" nullable="false" identity="false"
  16. default="0" comment="Sort Order"/>
  17. <column xsi:type="smallint" name="default_group_id" padding="5" unsigned="true" nullable="false"
  18. identity="false" default="0" comment="Default Group Id"/>
  19. <column xsi:type="smallint" name="is_default" padding="5" unsigned="true" nullable="true" identity="false"
  20. default="0" comment="Defines Is Website Default"/>
  21. <constraint xsi:type="primary" referenceId="PRIMARY">
  22. <column name="website_id"/>
  23. </constraint>
  24. <constraint xsi:type="unique" referenceId="STORE_WEBSITE_CODE">
  25. <column name="code"/>
  26. </constraint>
  27. <index referenceId="STORE_WEBSITE_SORT_ORDER" indexType="btree">
  28. <column name="sort_order"/>
  29. </index>
  30. <index referenceId="STORE_WEBSITE_DEFAULT_GROUP_ID" indexType="btree">
  31. <column name="default_group_id"/>
  32. </index>
  33. </table>
  34. <table name="store_group" resource="default" engine="innodb" comment="Store Groups">
  35. <column xsi:type="smallint" name="group_id" padding="5" unsigned="true" nullable="false" identity="true"
  36. comment="Group Id"/>
  37. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
  38. default="0" comment="Website Id"/>
  39. <column xsi:type="varchar" name="name" nullable="false" length="255" comment="Store Group Name"/>
  40. <column xsi:type="int" name="root_category_id" padding="10" unsigned="true" nullable="false" identity="false"
  41. default="0" comment="Root Category Id"/>
  42. <column xsi:type="smallint" name="default_store_id" padding="5" unsigned="true" nullable="false"
  43. identity="false" default="0" comment="Default Store Id"/>
  44. <column xsi:type="varchar" name="code" nullable="true" length="32" comment="Store group unique code"/>
  45. <constraint xsi:type="primary" referenceId="PRIMARY">
  46. <column name="group_id"/>
  47. </constraint>
  48. <constraint xsi:type="foreign" referenceId="STORE_GROUP_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID" table="store_group"
  49. column="website_id" referenceTable="store_website" referenceColumn="website_id" onDelete="CASCADE"/>
  50. <constraint xsi:type="unique" referenceId="STORE_GROUP_CODE">
  51. <column name="code"/>
  52. </constraint>
  53. <index referenceId="STORE_GROUP_WEBSITE_ID" indexType="btree">
  54. <column name="website_id"/>
  55. </index>
  56. <index referenceId="STORE_GROUP_DEFAULT_STORE_ID" indexType="btree">
  57. <column name="default_store_id"/>
  58. </index>
  59. </table>
  60. <table name="store" resource="default" engine="innodb" comment="Stores">
  61. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="true"
  62. comment="Store Id"/>
  63. <column xsi:type="varchar" name="code" nullable="true" length="32" comment="Code"/>
  64. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
  65. default="0" comment="Website Id"/>
  66. <column xsi:type="smallint" name="group_id" padding="5" unsigned="true" nullable="false" identity="false"
  67. default="0" comment="Group Id"/>
  68. <column xsi:type="varchar" name="name" nullable="false" length="255" comment="Store Name"/>
  69. <column xsi:type="smallint" name="sort_order" padding="5" unsigned="true" nullable="false" identity="false"
  70. default="0" comment="Store Sort Order"/>
  71. <column xsi:type="smallint" name="is_active" padding="5" unsigned="true" nullable="false" identity="false"
  72. default="0" comment="Store Activity"/>
  73. <constraint xsi:type="primary" referenceId="PRIMARY">
  74. <column name="store_id"/>
  75. </constraint>
  76. <constraint xsi:type="foreign" referenceId="STORE_GROUP_ID_STORE_GROUP_GROUP_ID" table="store" column="group_id"
  77. referenceTable="store_group" referenceColumn="group_id" onDelete="CASCADE"/>
  78. <constraint xsi:type="foreign" referenceId="STORE_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID" table="store"
  79. column="website_id" referenceTable="store_website" referenceColumn="website_id" onDelete="CASCADE"/>
  80. <constraint xsi:type="unique" referenceId="STORE_CODE">
  81. <column name="code"/>
  82. </constraint>
  83. <index referenceId="STORE_WEBSITE_ID" indexType="btree">
  84. <column name="website_id"/>
  85. </index>
  86. <index referenceId="STORE_IS_ACTIVE_SORT_ORDER" indexType="btree">
  87. <column name="is_active"/>
  88. <column name="sort_order"/>
  89. </index>
  90. <index referenceId="STORE_GROUP_ID" indexType="btree">
  91. <column name="group_id"/>
  92. </index>
  93. </table>
  94. </schema>