db_schema.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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="tax_class" resource="default" engine="innodb" comment="Tax Class">
  11. <column xsi:type="smallint" name="class_id" padding="6" unsigned="false" nullable="false" identity="true"
  12. comment="Class Id"/>
  13. <column xsi:type="varchar" name="class_name" nullable="false" length="255" comment="Class Name"/>
  14. <column xsi:type="varchar" name="class_type" nullable="false" length="8" default="CUSTOMER"
  15. comment="Class Type"/>
  16. <constraint xsi:type="primary" referenceId="PRIMARY">
  17. <column name="class_id"/>
  18. </constraint>
  19. </table>
  20. <table name="tax_calculation_rule" resource="default" engine="innodb" comment="Tax Calculation Rule">
  21. <column xsi:type="int" name="tax_calculation_rule_id" padding="11" unsigned="false" nullable="false"
  22. identity="true" comment="Tax Calculation Rule Id"/>
  23. <column xsi:type="varchar" name="code" nullable="false" length="255" comment="Code"/>
  24. <column xsi:type="int" name="priority" padding="11" unsigned="false" nullable="false" identity="false"
  25. comment="Priority"/>
  26. <column xsi:type="int" name="position" padding="11" unsigned="false" nullable="false" identity="false"
  27. comment="Position"/>
  28. <column xsi:type="int" name="calculate_subtotal" padding="11" unsigned="false" nullable="false" identity="false"
  29. comment="Calculate off subtotal option"/>
  30. <constraint xsi:type="primary" referenceId="PRIMARY">
  31. <column name="tax_calculation_rule_id"/>
  32. </constraint>
  33. <index referenceId="TAX_CALCULATION_RULE_PRIORITY_POSITION" indexType="btree">
  34. <column name="priority"/>
  35. <column name="position"/>
  36. </index>
  37. <index referenceId="TAX_CALCULATION_RULE_CODE" indexType="btree">
  38. <column name="code"/>
  39. </index>
  40. </table>
  41. <table name="tax_calculation_rate" resource="default" engine="innodb" comment="Tax Calculation Rate">
  42. <column xsi:type="int" name="tax_calculation_rate_id" padding="11" unsigned="false" nullable="false"
  43. identity="true" comment="Tax Calculation Rate Id"/>
  44. <column xsi:type="varchar" name="tax_country_id" nullable="false" length="2" comment="Tax Country Id"/>
  45. <column xsi:type="int" name="tax_region_id" padding="11" unsigned="false" nullable="false" identity="false"
  46. comment="Tax Region Id"/>
  47. <column xsi:type="varchar" name="tax_postcode" nullable="true" length="21" comment="Tax Postcode"/>
  48. <column xsi:type="varchar" name="code" nullable="false" length="255" comment="Code"/>
  49. <column xsi:type="decimal" name="rate" scale="4" precision="12" unsigned="false" nullable="false"
  50. comment="Rate"/>
  51. <column xsi:type="smallint" name="zip_is_range" padding="6" unsigned="false" nullable="true" identity="false"
  52. comment="Zip Is Range"/>
  53. <column xsi:type="int" name="zip_from" padding="10" unsigned="true" nullable="true" identity="false"
  54. comment="Zip From"/>
  55. <column xsi:type="int" name="zip_to" padding="10" unsigned="true" nullable="true" identity="false"
  56. comment="Zip To"/>
  57. <constraint xsi:type="primary" referenceId="PRIMARY">
  58. <column name="tax_calculation_rate_id"/>
  59. </constraint>
  60. <index referenceId="TAX_CALCULATION_RATE_TAX_COUNTRY_ID_TAX_REGION_ID_TAX_POSTCODE" indexType="btree">
  61. <column name="tax_country_id"/>
  62. <column name="tax_region_id"/>
  63. <column name="tax_postcode"/>
  64. </index>
  65. <index referenceId="TAX_CALCULATION_RATE_CODE" indexType="btree">
  66. <column name="code"/>
  67. </index>
  68. <index referenceId="IDX_CA799F1E2CB843495F601E56C84A626D" indexType="btree">
  69. <column name="tax_calculation_rate_id"/>
  70. <column name="tax_country_id"/>
  71. <column name="tax_region_id"/>
  72. <column name="zip_is_range"/>
  73. <column name="tax_postcode"/>
  74. </index>
  75. </table>
  76. <table name="tax_calculation" resource="default" engine="innodb" comment="Tax Calculation">
  77. <column xsi:type="int" name="tax_calculation_id" padding="11" unsigned="false" nullable="false" identity="true"
  78. comment="Tax Calculation Id"/>
  79. <column xsi:type="int" name="tax_calculation_rate_id" padding="11" unsigned="false" nullable="false"
  80. identity="false" comment="Tax Calculation Rate Id"/>
  81. <column xsi:type="int" name="tax_calculation_rule_id" padding="11" unsigned="false" nullable="false"
  82. identity="false" comment="Tax Calculation Rule Id"/>
  83. <column xsi:type="smallint" name="customer_tax_class_id" padding="6" unsigned="false" nullable="false"
  84. identity="false" comment="Customer Tax Class Id"/>
  85. <column xsi:type="smallint" name="product_tax_class_id" padding="6" unsigned="false" nullable="false"
  86. identity="false" comment="Product Tax Class Id"/>
  87. <constraint xsi:type="primary" referenceId="PRIMARY">
  88. <column name="tax_calculation_id"/>
  89. </constraint>
  90. <constraint xsi:type="foreign" referenceId="TAX_CALCULATION_PRODUCT_TAX_CLASS_ID_TAX_CLASS_CLASS_ID"
  91. table="tax_calculation" column="product_tax_class_id" referenceTable="tax_class"
  92. referenceColumn="class_id" onDelete="CASCADE"/>
  93. <constraint xsi:type="foreign" referenceId="TAX_CALCULATION_CUSTOMER_TAX_CLASS_ID_TAX_CLASS_CLASS_ID"
  94. table="tax_calculation" column="customer_tax_class_id" referenceTable="tax_class"
  95. referenceColumn="class_id" onDelete="CASCADE"/>
  96. <constraint xsi:type="foreign" referenceId="TAX_CALC_TAX_CALC_RATE_ID_TAX_CALC_RATE_TAX_CALC_RATE_ID"
  97. table="tax_calculation" column="tax_calculation_rate_id" referenceTable="tax_calculation_rate"
  98. referenceColumn="tax_calculation_rate_id" onDelete="CASCADE"/>
  99. <constraint xsi:type="foreign" referenceId="TAX_CALC_TAX_CALC_RULE_ID_TAX_CALC_RULE_TAX_CALC_RULE_ID"
  100. table="tax_calculation" column="tax_calculation_rule_id" referenceTable="tax_calculation_rule"
  101. referenceColumn="tax_calculation_rule_id" onDelete="CASCADE"/>
  102. <index referenceId="TAX_CALCULATION_TAX_CALCULATION_RULE_ID" indexType="btree">
  103. <column name="tax_calculation_rule_id"/>
  104. </index>
  105. <index referenceId="TAX_CALCULATION_CUSTOMER_TAX_CLASS_ID" indexType="btree">
  106. <column name="customer_tax_class_id"/>
  107. </index>
  108. <index referenceId="TAX_CALCULATION_PRODUCT_TAX_CLASS_ID" indexType="btree">
  109. <column name="product_tax_class_id"/>
  110. </index>
  111. <index referenceId="TAX_CALC_TAX_CALC_RATE_ID_CSTR_TAX_CLASS_ID_PRD_TAX_CLASS_ID" indexType="btree">
  112. <column name="tax_calculation_rate_id"/>
  113. <column name="customer_tax_class_id"/>
  114. <column name="product_tax_class_id"/>
  115. </index>
  116. </table>
  117. <table name="tax_calculation_rate_title" resource="default" engine="innodb" comment="Tax Calculation Rate Title">
  118. <column xsi:type="int" name="tax_calculation_rate_title_id" padding="11" unsigned="false" nullable="false"
  119. identity="true" comment="Tax Calculation Rate Title Id"/>
  120. <column xsi:type="int" name="tax_calculation_rate_id" padding="11" unsigned="false" nullable="false"
  121. identity="false" comment="Tax Calculation Rate Id"/>
  122. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  123. comment="Store Id"/>
  124. <column xsi:type="varchar" name="value" nullable="false" length="255" comment="Value"/>
  125. <constraint xsi:type="primary" referenceId="PRIMARY">
  126. <column name="tax_calculation_rate_title_id"/>
  127. </constraint>
  128. <constraint xsi:type="foreign" referenceId="TAX_CALCULATION_RATE_TITLE_STORE_ID_STORE_STORE_ID"
  129. table="tax_calculation_rate_title" column="store_id" referenceTable="store"
  130. referenceColumn="store_id" onDelete="CASCADE"/>
  131. <constraint xsi:type="foreign" referenceId="FK_37FB965F786AD5897BB3AE90470C42AB" table="tax_calculation_rate_title"
  132. column="tax_calculation_rate_id" referenceTable="tax_calculation_rate"
  133. referenceColumn="tax_calculation_rate_id" onDelete="CASCADE"/>
  134. <index referenceId="TAX_CALCULATION_RATE_TITLE_TAX_CALCULATION_RATE_ID_STORE_ID" indexType="btree">
  135. <column name="tax_calculation_rate_id"/>
  136. <column name="store_id"/>
  137. </index>
  138. <index referenceId="TAX_CALCULATION_RATE_TITLE_STORE_ID" indexType="btree">
  139. <column name="store_id"/>
  140. </index>
  141. </table>
  142. <table name="tax_order_aggregated_created" resource="sales" engine="innodb" comment="Tax Order Aggregation">
  143. <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
  144. <column xsi:type="date" name="period" comment="Period"/>
  145. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  146. comment="Store Id"/>
  147. <column xsi:type="varchar" name="code" nullable="false" length="255" comment="Code"/>
  148. <column xsi:type="varchar" name="order_status" nullable="false" length="50" comment="Order Status"/>
  149. <column xsi:type="float" name="percent" unsigned="false" nullable="true" comment="Percent"/>
  150. <column xsi:type="int" name="orders_count" padding="10" unsigned="true" nullable="false" identity="false"
  151. default="0" comment="Orders Count"/>
  152. <column xsi:type="float" name="tax_base_amount_sum" unsigned="false" nullable="true"
  153. comment="Tax Base Amount Sum"/>
  154. <constraint xsi:type="primary" referenceId="PRIMARY">
  155. <column name="id"/>
  156. </constraint>
  157. <constraint xsi:type="foreign" referenceId="TAX_ORDER_AGGREGATED_CREATED_STORE_ID_STORE_STORE_ID"
  158. table="tax_order_aggregated_created" column="store_id" referenceTable="store"
  159. referenceColumn="store_id" onDelete="CASCADE"/>
  160. <constraint xsi:type="unique" referenceId="TAX_ORDER_AGGRED_CREATED_PERIOD_STORE_ID_CODE_PERCENT_ORDER_STS">
  161. <column name="period"/>
  162. <column name="store_id"/>
  163. <column name="code"/>
  164. <column name="percent"/>
  165. <column name="order_status"/>
  166. </constraint>
  167. <index referenceId="TAX_ORDER_AGGREGATED_CREATED_STORE_ID" indexType="btree">
  168. <column name="store_id"/>
  169. </index>
  170. </table>
  171. <table name="tax_order_aggregated_updated" resource="sales" engine="innodb"
  172. comment="Tax Order Aggregated Updated">
  173. <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
  174. <column xsi:type="date" name="period" comment="Period"/>
  175. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  176. comment="Store Id"/>
  177. <column xsi:type="varchar" name="code" nullable="false" length="255" comment="Code"/>
  178. <column xsi:type="varchar" name="order_status" nullable="false" length="50" comment="Order Status"/>
  179. <column xsi:type="float" name="percent" unsigned="false" nullable="true" comment="Percent"/>
  180. <column xsi:type="int" name="orders_count" padding="10" unsigned="true" nullable="false" identity="false"
  181. default="0" comment="Orders Count"/>
  182. <column xsi:type="float" name="tax_base_amount_sum" unsigned="false" nullable="true"
  183. comment="Tax Base Amount Sum"/>
  184. <constraint xsi:type="primary" referenceId="PRIMARY">
  185. <column name="id"/>
  186. </constraint>
  187. <constraint xsi:type="foreign" referenceId="TAX_ORDER_AGGREGATED_UPDATED_STORE_ID_STORE_STORE_ID"
  188. table="tax_order_aggregated_updated" column="store_id" referenceTable="store"
  189. referenceColumn="store_id" onDelete="CASCADE"/>
  190. <constraint xsi:type="unique" referenceId="TAX_ORDER_AGGRED_UPDATED_PERIOD_STORE_ID_CODE_PERCENT_ORDER_STS">
  191. <column name="period"/>
  192. <column name="store_id"/>
  193. <column name="code"/>
  194. <column name="percent"/>
  195. <column name="order_status"/>
  196. </constraint>
  197. <index referenceId="TAX_ORDER_AGGREGATED_UPDATED_STORE_ID" indexType="btree">
  198. <column name="store_id"/>
  199. </index>
  200. </table>
  201. </schema>