db_schema.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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="salesrule" resource="default" engine="innodb" comment="Salesrule">
  11. <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="true"
  12. comment="Entity ID"/>
  13. <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Name"/>
  14. <column xsi:type="text" name="description" nullable="true" comment="Description"/>
  15. <column xsi:type="date" name="from_date" comment="From"/>
  16. <column xsi:type="date" name="to_date" comment="To"/>
  17. <column xsi:type="int" name="uses_per_customer" padding="11" unsigned="false" nullable="false" identity="false"
  18. default="0" comment="Uses Per Customer"/>
  19. <column xsi:type="smallint" name="is_active" padding="6" unsigned="false" nullable="false" identity="false"
  20. default="0" comment="Is Active"/>
  21. <column xsi:type="mediumtext" name="conditions_serialized" nullable="true" comment="Conditions Serialized"/>
  22. <column xsi:type="mediumtext" name="actions_serialized" nullable="true" comment="Actions Serialized"/>
  23. <column xsi:type="smallint" name="stop_rules_processing" padding="6" unsigned="false" nullable="false"
  24. identity="false" default="1" comment="Stop Rules Processing"/>
  25. <column xsi:type="smallint" name="is_advanced" padding="5" unsigned="true" nullable="false" identity="false"
  26. default="1" comment="Is Advanced"/>
  27. <column xsi:type="text" name="product_ids" nullable="true" comment="Product Ids"/>
  28. <column xsi:type="int" name="sort_order" padding="10" unsigned="true" nullable="false" identity="false"
  29. default="0" comment="Sort Order"/>
  30. <column xsi:type="varchar" name="simple_action" nullable="true" length="32" comment="Simple Action"/>
  31. <column xsi:type="decimal" name="discount_amount" scale="4" precision="12" unsigned="false" nullable="false"
  32. default="0" comment="Discount Amount"/>
  33. <column xsi:type="decimal" name="discount_qty" scale="4" precision="12" unsigned="false" nullable="true"
  34. comment="Discount Qty"/>
  35. <column xsi:type="int" name="discount_step" padding="10" unsigned="true" nullable="false" identity="false"
  36. default="0" comment="Discount Step"/>
  37. <column xsi:type="smallint" name="apply_to_shipping" padding="5" unsigned="true" nullable="false"
  38. identity="false" default="0" comment="Apply To Shipping"/>
  39. <column xsi:type="int" name="times_used" padding="10" unsigned="true" nullable="false" identity="false"
  40. default="0" comment="Times Used"/>
  41. <column xsi:type="smallint" name="is_rss" padding="6" unsigned="false" nullable="false" identity="false"
  42. default="0" comment="Is Rss"/>
  43. <column xsi:type="smallint" name="coupon_type" padding="5" unsigned="true" nullable="false" identity="false"
  44. default="1" comment="Coupon Type"/>
  45. <column xsi:type="smallint" name="use_auto_generation" padding="6" unsigned="false" nullable="false"
  46. identity="false" default="0" comment="Use Auto Generation"/>
  47. <column xsi:type="int" name="uses_per_coupon" padding="11" unsigned="false" nullable="false" identity="false"
  48. default="0" comment="User Per Coupon"/>
  49. <constraint xsi:type="primary" referenceId="PRIMARY">
  50. <column name="rule_id"/>
  51. </constraint>
  52. <index referenceId="SALESRULE_IS_ACTIVE_SORT_ORDER_TO_DATE_FROM_DATE" indexType="btree">
  53. <column name="is_active"/>
  54. <column name="sort_order"/>
  55. <column name="to_date"/>
  56. <column name="from_date"/>
  57. </index>
  58. </table>
  59. <table name="salesrule_coupon" resource="default" engine="innodb" comment="Salesrule Coupon">
  60. <column xsi:type="int" name="coupon_id" padding="10" unsigned="true" nullable="false" identity="true"
  61. comment="Coupon Id"/>
  62. <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"
  63. comment="Rule ID"/>
  64. <column xsi:type="varchar" name="code" nullable="true" length="255" comment="Code"/>
  65. <column xsi:type="int" name="usage_limit" padding="10" unsigned="true" nullable="true" identity="false"
  66. comment="Usage Limit"/>
  67. <column xsi:type="int" name="usage_per_customer" padding="10" unsigned="true" nullable="true" identity="false"
  68. comment="Usage Per Customer"/>
  69. <column xsi:type="int" name="times_used" padding="10" unsigned="true" nullable="false" identity="false"
  70. default="0" comment="Times Used"/>
  71. <column xsi:type="timestamp" name="expiration_date" on_update="false" nullable="true"
  72. comment="Expiration Date"/>
  73. <column xsi:type="smallint" name="is_primary" padding="5" unsigned="true" nullable="true" identity="false"
  74. comment="Is Primary"/>
  75. <column xsi:type="timestamp" name="created_at" on_update="false" nullable="true"
  76. comment="Coupon Code Creation Date"/>
  77. <column xsi:type="smallint" name="type" padding="6" unsigned="false" nullable="true" identity="false"
  78. default="0" comment="Coupon Code Type"/>
  79. <constraint xsi:type="primary" referenceId="PRIMARY">
  80. <column name="coupon_id"/>
  81. </constraint>
  82. <constraint xsi:type="foreign" referenceId="SALESRULE_COUPON_RULE_ID_SALESRULE_RULE_ID" table="salesrule_coupon"
  83. column="rule_id" referenceTable="salesrule" referenceColumn="rule_id" onDelete="CASCADE"/>
  84. <constraint xsi:type="unique" referenceId="SALESRULE_COUPON_CODE">
  85. <column name="code"/>
  86. </constraint>
  87. <constraint xsi:type="unique" referenceId="SALESRULE_COUPON_RULE_ID_IS_PRIMARY">
  88. <column name="rule_id"/>
  89. <column name="is_primary"/>
  90. </constraint>
  91. <index referenceId="SALESRULE_COUPON_RULE_ID" indexType="btree">
  92. <column name="rule_id"/>
  93. </index>
  94. </table>
  95. <table name="salesrule_coupon_usage" resource="default" engine="innodb" comment="Salesrule Coupon Usage">
  96. <column xsi:type="int" name="coupon_id" padding="10" unsigned="true" nullable="false" identity="false"
  97. comment="Coupon Id"/>
  98. <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="false" identity="false"
  99. comment="Customer Id"/>
  100. <column xsi:type="int" name="times_used" padding="10" unsigned="true" nullable="false" identity="false"
  101. default="0" comment="Times Used"/>
  102. <constraint xsi:type="primary" referenceId="PRIMARY">
  103. <column name="coupon_id"/>
  104. <column name="customer_id"/>
  105. </constraint>
  106. <constraint xsi:type="foreign" referenceId="SALESRULE_COUPON_USAGE_COUPON_ID_SALESRULE_COUPON_COUPON_ID"
  107. table="salesrule_coupon_usage" column="coupon_id" referenceTable="salesrule_coupon"
  108. referenceColumn="coupon_id" onDelete="CASCADE"/>
  109. <constraint xsi:type="foreign" referenceId="SALESRULE_COUPON_USAGE_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID"
  110. table="salesrule_coupon_usage" column="customer_id" referenceTable="customer_entity"
  111. referenceColumn="entity_id" onDelete="CASCADE"/>
  112. <index referenceId="SALESRULE_COUPON_USAGE_CUSTOMER_ID" indexType="btree">
  113. <column name="customer_id"/>
  114. </index>
  115. </table>
  116. <table name="salesrule_customer" resource="default" engine="innodb" comment="Salesrule Customer">
  117. <column xsi:type="int" name="rule_customer_id" padding="10" unsigned="true" nullable="false" identity="true"
  118. comment="Rule Customer Id"/>
  119. <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
  120. comment="Rule ID"/>
  121. <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="false" identity="false"
  122. default="0" comment="Customer Id"/>
  123. <column xsi:type="smallint" name="times_used" padding="5" unsigned="true" nullable="false" identity="false"
  124. default="0" comment="Times Used"/>
  125. <constraint xsi:type="primary" referenceId="PRIMARY">
  126. <column name="rule_customer_id"/>
  127. </constraint>
  128. <constraint xsi:type="foreign" referenceId="SALESRULE_CUSTOMER_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID"
  129. table="salesrule_customer" column="customer_id" referenceTable="customer_entity"
  130. referenceColumn="entity_id" onDelete="CASCADE"/>
  131. <constraint xsi:type="foreign" referenceId="SALESRULE_CUSTOMER_RULE_ID_SALESRULE_RULE_ID" table="salesrule_customer"
  132. column="rule_id" referenceTable="salesrule" referenceColumn="rule_id" onDelete="CASCADE"/>
  133. <index referenceId="SALESRULE_CUSTOMER_RULE_ID_CUSTOMER_ID" indexType="btree">
  134. <column name="rule_id"/>
  135. <column name="customer_id"/>
  136. </index>
  137. <index referenceId="SALESRULE_CUSTOMER_CUSTOMER_ID_RULE_ID" indexType="btree">
  138. <column name="customer_id"/>
  139. <column name="rule_id"/>
  140. </index>
  141. </table>
  142. <table name="salesrule_label" resource="default" engine="innodb" comment="Salesrule Label">
  143. <column xsi:type="int" name="label_id" padding="10" unsigned="true" nullable="false" identity="true"
  144. comment="Label Id"/>
  145. <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"
  146. comment="Rule ID"/>
  147. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  148. comment="Store Id"/>
  149. <column xsi:type="varchar" name="label" nullable="true" length="255" comment="Label"/>
  150. <constraint xsi:type="primary" referenceId="PRIMARY">
  151. <column name="label_id"/>
  152. </constraint>
  153. <constraint xsi:type="foreign" referenceId="SALESRULE_LABEL_RULE_ID_SALESRULE_RULE_ID" table="salesrule_label"
  154. column="rule_id" referenceTable="salesrule" referenceColumn="rule_id" onDelete="CASCADE"/>
  155. <constraint xsi:type="foreign" referenceId="SALESRULE_LABEL_STORE_ID_STORE_STORE_ID" table="salesrule_label"
  156. column="store_id" referenceTable="store" referenceColumn="store_id" onDelete="CASCADE"/>
  157. <constraint xsi:type="unique" referenceId="SALESRULE_LABEL_RULE_ID_STORE_ID">
  158. <column name="rule_id"/>
  159. <column name="store_id"/>
  160. </constraint>
  161. <index referenceId="SALESRULE_LABEL_STORE_ID" indexType="btree">
  162. <column name="store_id"/>
  163. </index>
  164. </table>
  165. <table name="salesrule_product_attribute" resource="default" engine="innodb" comment="Salesrule Product Attribute">
  166. <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"
  167. comment="Rule ID"/>
  168. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
  169. comment="Website Id"/>
  170. <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
  171. comment="Customer Group Id"/>
  172. <column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false"
  173. comment="Attribute Id"/>
  174. <constraint xsi:type="primary" referenceId="PRIMARY">
  175. <column name="rule_id"/>
  176. <column name="website_id"/>
  177. <column name="customer_group_id"/>
  178. <column name="attribute_id"/>
  179. </constraint>
  180. <constraint xsi:type="foreign" referenceId="SALESRULE_PRD_ATTR_ATTR_ID_EAV_ATTR_ATTR_ID"
  181. table="salesrule_product_attribute" column="attribute_id" referenceTable="eav_attribute"
  182. referenceColumn="attribute_id" onDelete="CASCADE"/>
  183. <constraint xsi:type="foreign" referenceId="SALESRULE_PRD_ATTR_CSTR_GROUP_ID_CSTR_GROUP_CSTR_GROUP_ID"
  184. table="salesrule_product_attribute" column="customer_group_id" referenceTable="customer_group"
  185. referenceColumn="customer_group_id" onDelete="CASCADE"/>
  186. <constraint xsi:type="foreign" referenceId="SALESRULE_PRODUCT_ATTRIBUTE_RULE_ID_SALESRULE_RULE_ID"
  187. table="salesrule_product_attribute" column="rule_id" referenceTable="salesrule"
  188. referenceColumn="rule_id" onDelete="CASCADE"/>
  189. <constraint xsi:type="foreign" referenceId="SALESRULE_PRODUCT_ATTRIBUTE_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID"
  190. table="salesrule_product_attribute" column="website_id" referenceTable="store_website"
  191. referenceColumn="website_id" onDelete="CASCADE"/>
  192. <index referenceId="SALESRULE_PRODUCT_ATTRIBUTE_WEBSITE_ID" indexType="btree">
  193. <column name="website_id"/>
  194. </index>
  195. <index referenceId="SALESRULE_PRODUCT_ATTRIBUTE_CUSTOMER_GROUP_ID" indexType="btree">
  196. <column name="customer_group_id"/>
  197. </index>
  198. <index referenceId="SALESRULE_PRODUCT_ATTRIBUTE_ATTRIBUTE_ID" indexType="btree">
  199. <column name="attribute_id"/>
  200. </index>
  201. </table>
  202. <table name="salesrule_coupon_aggregated" resource="sales" engine="innodb" comment="Coupon Aggregated">
  203. <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
  204. <column xsi:type="date" name="period" nullable="false" comment="Period"/>
  205. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  206. comment="Store Id"/>
  207. <column xsi:type="varchar" name="order_status" nullable="true" length="50" comment="Order Status"/>
  208. <column xsi:type="varchar" name="coupon_code" nullable="true" length="50" comment="Coupon Code"/>
  209. <column xsi:type="int" name="coupon_uses" padding="11" unsigned="false" nullable="false" identity="false"
  210. default="0" comment="Coupon Uses"/>
  211. <column xsi:type="decimal" name="subtotal_amount" scale="4" precision="20" unsigned="false" nullable="false"
  212. default="0" comment="Subtotal Amount"/>
  213. <column xsi:type="decimal" name="discount_amount" scale="4" precision="12" unsigned="false" nullable="false"
  214. default="0" comment="Discount Amount"/>
  215. <column xsi:type="decimal" name="total_amount" scale="4" precision="20" unsigned="false" nullable="false"
  216. default="0" comment="Total Amount"/>
  217. <column xsi:type="decimal" name="subtotal_amount_actual" scale="4" precision="20" unsigned="false"
  218. nullable="false" default="0" comment="Subtotal Amount Actual"/>
  219. <column xsi:type="decimal" name="discount_amount_actual" scale="4" precision="12" unsigned="false"
  220. nullable="false" default="0" comment="Discount Amount Actual"/>
  221. <column xsi:type="decimal" name="total_amount_actual" scale="4" precision="20" unsigned="false"
  222. nullable="false" default="0" comment="Total Amount Actual"/>
  223. <column xsi:type="varchar" name="rule_name" nullable="true" length="255" comment="Rule Name"/>
  224. <constraint xsi:type="primary" referenceId="PRIMARY">
  225. <column name="id"/>
  226. </constraint>
  227. <constraint xsi:type="foreign" referenceId="SALESRULE_COUPON_AGGREGATED_STORE_ID_STORE_STORE_ID"
  228. table="salesrule_coupon_aggregated" column="store_id" referenceTable="store"
  229. referenceColumn="store_id" onDelete="CASCADE"/>
  230. <constraint xsi:type="unique" referenceId="SALESRULE_COUPON_AGGRED_PERIOD_STORE_ID_ORDER_STS_COUPON_CODE">
  231. <column name="period"/>
  232. <column name="store_id"/>
  233. <column name="order_status"/>
  234. <column name="coupon_code"/>
  235. </constraint>
  236. <index referenceId="SALESRULE_COUPON_AGGREGATED_STORE_ID" indexType="btree">
  237. <column name="store_id"/>
  238. </index>
  239. <index referenceId="SALESRULE_COUPON_AGGREGATED_RULE_NAME" indexType="btree">
  240. <column name="rule_name"/>
  241. </index>
  242. </table>
  243. <table name="salesrule_coupon_aggregated_updated" resource="sales" engine="innodb"
  244. comment="Salesrule Coupon Aggregated Updated">
  245. <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
  246. <column xsi:type="date" name="period" nullable="false" comment="Period"/>
  247. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  248. comment="Store Id"/>
  249. <column xsi:type="varchar" name="order_status" nullable="true" length="50" comment="Order Status"/>
  250. <column xsi:type="varchar" name="coupon_code" nullable="true" length="50" comment="Coupon Code"/>
  251. <column xsi:type="int" name="coupon_uses" padding="11" unsigned="false" nullable="false" identity="false"
  252. default="0" comment="Coupon Uses"/>
  253. <column xsi:type="decimal" name="subtotal_amount" scale="4" precision="20" unsigned="false" nullable="false"
  254. default="0" comment="Subtotal Amount"/>
  255. <column xsi:type="decimal" name="discount_amount" scale="4" precision="12" unsigned="false" nullable="false"
  256. default="0" comment="Discount Amount"/>
  257. <column xsi:type="decimal" name="total_amount" scale="4" precision="20" unsigned="false" nullable="false"
  258. default="0" comment="Total Amount"/>
  259. <column xsi:type="decimal" name="subtotal_amount_actual" scale="4" precision="20" unsigned="false"
  260. nullable="false" default="0" comment="Subtotal Amount Actual"/>
  261. <column xsi:type="decimal" name="discount_amount_actual" scale="4" precision="12" unsigned="false"
  262. nullable="false" default="0" comment="Discount Amount Actual"/>
  263. <column xsi:type="decimal" name="total_amount_actual" scale="4" precision="20" unsigned="false"
  264. nullable="false" default="0" comment="Total Amount Actual"/>
  265. <column xsi:type="varchar" name="rule_name" nullable="true" length="255" comment="Rule Name"/>
  266. <constraint xsi:type="primary" referenceId="PRIMARY">
  267. <column name="id"/>
  268. </constraint>
  269. <constraint xsi:type="foreign" referenceId="SALESRULE_COUPON_AGGREGATED_UPDATED_STORE_ID_STORE_STORE_ID"
  270. table="salesrule_coupon_aggregated_updated" column="store_id" referenceTable="store"
  271. referenceColumn="store_id" onDelete="CASCADE"/>
  272. <constraint xsi:type="unique" referenceId="UNQ_7196FA120A4F0F84E1B66605E87E213E">
  273. <column name="period"/>
  274. <column name="store_id"/>
  275. <column name="order_status"/>
  276. <column name="coupon_code"/>
  277. </constraint>
  278. <index referenceId="SALESRULE_COUPON_AGGREGATED_UPDATED_STORE_ID" indexType="btree">
  279. <column name="store_id"/>
  280. </index>
  281. <index referenceId="SALESRULE_COUPON_AGGREGATED_UPDATED_RULE_NAME" indexType="btree">
  282. <column name="rule_name"/>
  283. </index>
  284. </table>
  285. <table name="salesrule_coupon_aggregated_order" resource="default" engine="innodb"
  286. comment="Coupon Aggregated Order">
  287. <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
  288. <column xsi:type="date" name="period" nullable="false" comment="Period"/>
  289. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  290. comment="Store Id"/>
  291. <column xsi:type="varchar" name="order_status" nullable="true" length="50" comment="Order Status"/>
  292. <column xsi:type="varchar" name="coupon_code" nullable="true" length="50" comment="Coupon Code"/>
  293. <column xsi:type="int" name="coupon_uses" padding="11" unsigned="false" nullable="false" identity="false"
  294. default="0" comment="Coupon Uses"/>
  295. <column xsi:type="decimal" name="subtotal_amount" scale="4" precision="20" unsigned="false" nullable="false"
  296. default="0" comment="Subtotal Amount"/>
  297. <column xsi:type="decimal" name="discount_amount" scale="4" precision="12" unsigned="false" nullable="false"
  298. default="0" comment="Discount Amount"/>
  299. <column xsi:type="decimal" name="total_amount" scale="4" precision="20" unsigned="false" nullable="false"
  300. default="0" comment="Total Amount"/>
  301. <column xsi:type="varchar" name="rule_name" nullable="true" length="255" comment="Rule Name"/>
  302. <constraint xsi:type="primary" referenceId="PRIMARY">
  303. <column name="id"/>
  304. </constraint>
  305. <constraint xsi:type="foreign" referenceId="SALESRULE_COUPON_AGGREGATED_ORDER_STORE_ID_STORE_STORE_ID"
  306. table="salesrule_coupon_aggregated_order" column="store_id" referenceTable="store"
  307. referenceColumn="store_id" onDelete="CASCADE"/>
  308. <constraint xsi:type="unique" referenceId="UNQ_1094D1FBBCBB11704A29DEF3ACC37D2B">
  309. <column name="period"/>
  310. <column name="store_id"/>
  311. <column name="order_status"/>
  312. <column name="coupon_code"/>
  313. </constraint>
  314. <index referenceId="SALESRULE_COUPON_AGGREGATED_ORDER_STORE_ID" indexType="btree">
  315. <column name="store_id"/>
  316. </index>
  317. <index referenceId="SALESRULE_COUPON_AGGREGATED_ORDER_RULE_NAME" indexType="btree">
  318. <column name="rule_name"/>
  319. </index>
  320. </table>
  321. <table name="salesrule_website" resource="default" engine="innodb" comment="Sales Rules To Websites Relations">
  322. <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"
  323. comment="Rule ID"/>
  324. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
  325. comment="Website Id"/>
  326. <constraint xsi:type="primary" referenceId="PRIMARY">
  327. <column name="rule_id"/>
  328. <column name="website_id"/>
  329. </constraint>
  330. <constraint xsi:type="foreign" referenceId="SALESRULE_WEBSITE_RULE_ID_SALESRULE_RULE_ID" table="salesrule_website"
  331. column="rule_id" referenceTable="salesrule" referenceColumn="rule_id" onDelete="CASCADE"/>
  332. <constraint xsi:type="foreign" referenceId="SALESRULE_WEBSITE_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID"
  333. table="salesrule_website" column="website_id" referenceTable="store_website"
  334. referenceColumn="website_id" onDelete="CASCADE"/>
  335. <index referenceId="SALESRULE_WEBSITE_WEBSITE_ID" indexType="btree">
  336. <column name="website_id"/>
  337. </index>
  338. </table>
  339. <table name="salesrule_customer_group" resource="default" engine="innodb"
  340. comment="Sales Rules To Customer Groups Relations">
  341. <column xsi:type="int" name="rule_id" padding="10" unsigned="true" nullable="false" identity="false"
  342. comment="Rule ID"/>
  343. <column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
  344. comment="Customer Group Id"/>
  345. <constraint xsi:type="primary" referenceId="PRIMARY">
  346. <column name="rule_id"/>
  347. <column name="customer_group_id"/>
  348. </constraint>
  349. <constraint xsi:type="foreign" referenceId="SALESRULE_CUSTOMER_GROUP_RULE_ID_SALESRULE_RULE_ID"
  350. table="salesrule_customer_group" column="rule_id" referenceTable="salesrule"
  351. referenceColumn="rule_id" onDelete="CASCADE"/>
  352. <constraint xsi:type="foreign" referenceId="SALESRULE_CSTR_GROUP_CSTR_GROUP_ID_CSTR_GROUP_CSTR_GROUP_ID"
  353. table="salesrule_customer_group" column="customer_group_id" referenceTable="customer_group"
  354. referenceColumn="customer_group_id" onDelete="CASCADE"/>
  355. <index referenceId="SALESRULE_CUSTOMER_GROUP_CUSTOMER_GROUP_ID" indexType="btree">
  356. <column name="customer_group_id"/>
  357. </index>
  358. </table>
  359. </schema>