db_schema.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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="downloadable_link" resource="default" engine="innodb" comment="Downloadable Link Table">
  11. <column xsi:type="int" name="link_id" padding="10" unsigned="true" nullable="false" identity="true"
  12. comment="Link ID"/>
  13. <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="false" identity="false"
  14. default="0" comment="Product ID"/>
  15. <column xsi:type="int" name="sort_order" padding="10" unsigned="true" nullable="false" identity="false"
  16. default="0" comment="Sort order"/>
  17. <column xsi:type="int" name="number_of_downloads" padding="11" unsigned="false" nullable="true" identity="false"
  18. comment="Number of downloads"/>
  19. <column xsi:type="smallint" name="is_shareable" padding="5" unsigned="true" nullable="false" identity="false"
  20. default="0" comment="Shareable flag"/>
  21. <column xsi:type="varchar" name="link_url" nullable="true" length="255" comment="Link Url"/>
  22. <column xsi:type="varchar" name="link_file" nullable="true" length="255" comment="Link File"/>
  23. <column xsi:type="varchar" name="link_type" nullable="true" length="20" comment="Link Type"/>
  24. <column xsi:type="varchar" name="sample_url" nullable="true" length="255" comment="Sample Url"/>
  25. <column xsi:type="varchar" name="sample_file" nullable="true" length="255" comment="Sample File"/>
  26. <column xsi:type="varchar" name="sample_type" nullable="true" length="20" comment="Sample Type"/>
  27. <constraint xsi:type="primary" referenceId="PRIMARY">
  28. <column name="link_id"/>
  29. </constraint>
  30. <constraint xsi:type="foreign" referenceId="DOWNLOADABLE_LINK_PRODUCT_ID_CATALOG_PRODUCT_ENTITY_ENTITY_ID"
  31. table="downloadable_link" column="product_id" referenceTable="catalog_product_entity"
  32. referenceColumn="entity_id" onDelete="CASCADE"/>
  33. <index referenceId="DOWNLOADABLE_LINK_PRODUCT_ID_SORT_ORDER" indexType="btree">
  34. <column name="product_id"/>
  35. <column name="sort_order"/>
  36. </index>
  37. </table>
  38. <table name="downloadable_link_price" resource="default" engine="innodb" comment="Downloadable Link Price Table">
  39. <column xsi:type="int" name="price_id" padding="10" unsigned="true" nullable="false" identity="true"
  40. comment="Price ID"/>
  41. <column xsi:type="int" name="link_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
  42. comment="Link ID"/>
  43. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
  44. default="0" comment="Website ID"/>
  45. <column xsi:type="decimal" name="price" scale="4" precision="12" unsigned="false" nullable="false" default="0"
  46. comment="Price"/>
  47. <constraint xsi:type="primary" referenceId="PRIMARY">
  48. <column name="price_id"/>
  49. </constraint>
  50. <constraint xsi:type="foreign" referenceId="DOWNLOADABLE_LINK_PRICE_LINK_ID_DOWNLOADABLE_LINK_LINK_ID"
  51. table="downloadable_link_price" column="link_id" referenceTable="downloadable_link"
  52. referenceColumn="link_id" onDelete="CASCADE"/>
  53. <constraint xsi:type="foreign" referenceId="DOWNLOADABLE_LINK_PRICE_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID"
  54. table="downloadable_link_price" column="website_id" referenceTable="store_website"
  55. referenceColumn="website_id" onDelete="CASCADE"/>
  56. <index referenceId="DOWNLOADABLE_LINK_PRICE_LINK_ID" indexType="btree">
  57. <column name="link_id"/>
  58. </index>
  59. <index referenceId="DOWNLOADABLE_LINK_PRICE_WEBSITE_ID" indexType="btree">
  60. <column name="website_id"/>
  61. </index>
  62. </table>
  63. <table name="downloadable_link_purchased" resource="default" engine="innodb"
  64. comment="Downloadable Link Purchased Table">
  65. <column xsi:type="int" name="purchased_id" padding="10" unsigned="true" nullable="false" identity="true"
  66. comment="Purchased ID"/>
  67. <column xsi:type="int" name="order_id" padding="10" unsigned="true" nullable="true" identity="false" default="0"
  68. comment="Order ID"/>
  69. <column xsi:type="varchar" name="order_increment_id" nullable="true" length="50" comment="Order Increment ID"/>
  70. <column xsi:type="int" name="order_item_id" padding="10" unsigned="true" nullable="false" identity="false"
  71. default="0" comment="Order Item ID"/>
  72. <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
  73. comment="Date of creation"/>
  74. <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP"
  75. comment="Date of modification"/>
  76. <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="true" identity="false"
  77. default="0" comment="Customer ID"/>
  78. <column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product name"/>
  79. <column xsi:type="varchar" name="product_sku" nullable="true" length="255" comment="Product sku"/>
  80. <column xsi:type="varchar" name="link_section_title" nullable="true" length="255" comment="Link_section_title"/>
  81. <constraint xsi:type="primary" referenceId="PRIMARY">
  82. <column name="purchased_id"/>
  83. </constraint>
  84. <constraint xsi:type="foreign" referenceId="DL_LNK_PURCHASED_CSTR_ID_CSTR_ENTT_ENTT_ID"
  85. table="downloadable_link_purchased" column="customer_id" referenceTable="customer_entity"
  86. referenceColumn="entity_id" onDelete="SET NULL"/>
  87. <constraint xsi:type="foreign" referenceId="DOWNLOADABLE_LINK_PURCHASED_ORDER_ID_SALES_ORDER_ENTITY_ID"
  88. table="downloadable_link_purchased" column="order_id" referenceTable="sales_order"
  89. referenceColumn="entity_id" onDelete="SET NULL"/>
  90. <index referenceId="DOWNLOADABLE_LINK_PURCHASED_ORDER_ID" indexType="btree">
  91. <column name="order_id"/>
  92. </index>
  93. <index referenceId="DOWNLOADABLE_LINK_PURCHASED_ORDER_ITEM_ID" indexType="btree">
  94. <column name="order_item_id"/>
  95. </index>
  96. <index referenceId="DOWNLOADABLE_LINK_PURCHASED_CUSTOMER_ID" indexType="btree">
  97. <column name="customer_id"/>
  98. </index>
  99. </table>
  100. <table name="downloadable_link_purchased_item" resource="default" engine="innodb"
  101. comment="Downloadable Link Purchased Item Table">
  102. <column xsi:type="int" name="item_id" padding="10" unsigned="true" nullable="false" identity="true"
  103. comment="Item ID"/>
  104. <column xsi:type="int" name="purchased_id" padding="10" unsigned="true" nullable="false" identity="false"
  105. default="0" comment="Purchased ID"/>
  106. <column xsi:type="int" name="order_item_id" padding="10" unsigned="true" nullable="true" identity="false"
  107. default="0" comment="Order Item ID"/>
  108. <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="true" identity="false"
  109. default="0" comment="Product ID"/>
  110. <column xsi:type="varchar" name="link_hash" nullable="true" length="255" comment="Link hash"/>
  111. <column xsi:type="int" name="number_of_downloads_bought" padding="10" unsigned="true" nullable="false"
  112. identity="false" default="0" comment="Number of downloads bought"/>
  113. <column xsi:type="int" name="number_of_downloads_used" padding="10" unsigned="true" nullable="false"
  114. identity="false" default="0" comment="Number of downloads used"/>
  115. <column xsi:type="int" name="link_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
  116. comment="Link ID"/>
  117. <column xsi:type="varchar" name="link_title" nullable="true" length="255" comment="Link Title"/>
  118. <column xsi:type="smallint" name="is_shareable" padding="5" unsigned="true" nullable="false" identity="false"
  119. default="0" comment="Shareable Flag"/>
  120. <column xsi:type="varchar" name="link_url" nullable="true" length="255" comment="Link Url"/>
  121. <column xsi:type="varchar" name="link_file" nullable="true" length="255" comment="Link File"/>
  122. <column xsi:type="varchar" name="link_type" nullable="true" length="255" comment="Link Type"/>
  123. <column xsi:type="varchar" name="status" nullable="true" length="50" comment="Status"/>
  124. <column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
  125. comment="Creation Time"/>
  126. <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP"
  127. comment="Update Time"/>
  128. <constraint xsi:type="primary" referenceId="PRIMARY">
  129. <column name="item_id"/>
  130. </constraint>
  131. <constraint xsi:type="foreign" referenceId="DL_LNK_PURCHASED_ITEM_PURCHASED_ID_DL_LNK_PURCHASED_PURCHASED_ID"
  132. table="downloadable_link_purchased_item" column="purchased_id"
  133. referenceTable="downloadable_link_purchased" referenceColumn="purchased_id" onDelete="CASCADE"/>
  134. <constraint xsi:type="foreign" referenceId="DL_LNK_PURCHASED_ITEM_ORDER_ITEM_ID_SALES_ORDER_ITEM_ITEM_ID"
  135. table="downloadable_link_purchased_item" column="order_item_id" referenceTable="sales_order_item"
  136. referenceColumn="item_id" onDelete="SET NULL"/>
  137. <index referenceId="DOWNLOADABLE_LINK_PURCHASED_ITEM_LINK_HASH" indexType="btree">
  138. <column name="link_hash"/>
  139. </index>
  140. <index referenceId="DOWNLOADABLE_LINK_PURCHASED_ITEM_ORDER_ITEM_ID" indexType="btree">
  141. <column name="order_item_id"/>
  142. </index>
  143. <index referenceId="DOWNLOADABLE_LINK_PURCHASED_ITEM_PURCHASED_ID" indexType="btree">
  144. <column name="purchased_id"/>
  145. </index>
  146. </table>
  147. <table name="downloadable_link_title" resource="default" engine="innodb" comment="Link Title Table">
  148. <column xsi:type="int" name="title_id" padding="10" unsigned="true" nullable="false" identity="true"
  149. comment="Title ID"/>
  150. <column xsi:type="int" name="link_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
  151. comment="Link ID"/>
  152. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  153. default="0" comment="Store ID"/>
  154. <column xsi:type="varchar" name="title" nullable="true" length="255" comment="Title"/>
  155. <constraint xsi:type="primary" referenceId="PRIMARY">
  156. <column name="title_id"/>
  157. </constraint>
  158. <constraint xsi:type="foreign" referenceId="DOWNLOADABLE_LINK_TITLE_LINK_ID_DOWNLOADABLE_LINK_LINK_ID"
  159. table="downloadable_link_title" column="link_id" referenceTable="downloadable_link"
  160. referenceColumn="link_id" onDelete="CASCADE"/>
  161. <constraint xsi:type="foreign" referenceId="DOWNLOADABLE_LINK_TITLE_STORE_ID_STORE_STORE_ID"
  162. table="downloadable_link_title" column="store_id" referenceTable="store" referenceColumn="store_id"
  163. onDelete="CASCADE"/>
  164. <constraint xsi:type="unique" referenceId="DOWNLOADABLE_LINK_TITLE_LINK_ID_STORE_ID">
  165. <column name="link_id"/>
  166. <column name="store_id"/>
  167. </constraint>
  168. <index referenceId="DOWNLOADABLE_LINK_TITLE_STORE_ID" indexType="btree">
  169. <column name="store_id"/>
  170. </index>
  171. </table>
  172. <table name="downloadable_sample" resource="default" engine="innodb" comment="Downloadable Sample Table">
  173. <column xsi:type="int" name="sample_id" padding="10" unsigned="true" nullable="false" identity="true"
  174. comment="Sample ID"/>
  175. <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="false" identity="false"
  176. default="0" comment="Product ID"/>
  177. <column xsi:type="varchar" name="sample_url" nullable="true" length="255" comment="Sample URL"/>
  178. <column xsi:type="varchar" name="sample_file" nullable="true" length="255" comment="Sample file"/>
  179. <column xsi:type="varchar" name="sample_type" nullable="true" length="20" comment="Sample Type"/>
  180. <column xsi:type="int" name="sort_order" padding="10" unsigned="true" nullable="false" identity="false"
  181. default="0" comment="Sort Order"/>
  182. <constraint xsi:type="primary" referenceId="PRIMARY">
  183. <column name="sample_id"/>
  184. </constraint>
  185. <constraint xsi:type="foreign" referenceId="DOWNLOADABLE_SAMPLE_PRODUCT_ID_CATALOG_PRODUCT_ENTITY_ENTITY_ID"
  186. table="downloadable_sample" column="product_id" referenceTable="catalog_product_entity"
  187. referenceColumn="entity_id" onDelete="CASCADE"/>
  188. <index referenceId="DOWNLOADABLE_SAMPLE_PRODUCT_ID" indexType="btree">
  189. <column name="product_id"/>
  190. </index>
  191. </table>
  192. <table name="downloadable_sample_title" resource="default" engine="innodb"
  193. comment="Downloadable Sample Title Table">
  194. <column xsi:type="int" name="title_id" padding="10" unsigned="true" nullable="false" identity="true"
  195. comment="Title ID"/>
  196. <column xsi:type="int" name="sample_id" padding="10" unsigned="true" nullable="false" identity="false"
  197. default="0" comment="Sample ID"/>
  198. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  199. default="0" comment="Store ID"/>
  200. <column xsi:type="varchar" name="title" nullable="true" length="255" comment="Title"/>
  201. <constraint xsi:type="primary" referenceId="PRIMARY">
  202. <column name="title_id"/>
  203. </constraint>
  204. <constraint xsi:type="foreign" referenceId="DL_SAMPLE_TTL_SAMPLE_ID_DL_SAMPLE_SAMPLE_ID"
  205. table="downloadable_sample_title" column="sample_id" referenceTable="downloadable_sample"
  206. referenceColumn="sample_id" onDelete="CASCADE"/>
  207. <constraint xsi:type="foreign" referenceId="DOWNLOADABLE_SAMPLE_TITLE_STORE_ID_STORE_STORE_ID"
  208. table="downloadable_sample_title" column="store_id" referenceTable="store"
  209. referenceColumn="store_id" onDelete="CASCADE"/>
  210. <constraint xsi:type="unique" referenceId="DOWNLOADABLE_SAMPLE_TITLE_SAMPLE_ID_STORE_ID">
  211. <column name="sample_id"/>
  212. <column name="store_id"/>
  213. </constraint>
  214. <index referenceId="DOWNLOADABLE_SAMPLE_TITLE_STORE_ID" indexType="btree">
  215. <column name="store_id"/>
  216. </index>
  217. </table>
  218. <table name="catalog_product_index_price_downlod_idx" resource="default" engine="innodb"
  219. comment="Indexer Table for price of downloadable products">
  220. <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
  221. comment="Entity ID"/>
  222. <column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
  223. identity="false"/>
  224. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
  225. comment="Website ID"/>
  226. <column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="false"
  227. default="0" comment="Minimum price"/>
  228. <column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="false"
  229. default="0" comment="Maximum price"/>
  230. <constraint xsi:type="primary" referenceId="PRIMARY">
  231. <column name="entity_id"/>
  232. <column name="customer_group_id"/>
  233. <column name="website_id"/>
  234. </constraint>
  235. </table>
  236. <table name="catalog_product_index_price_downlod_tmp" resource="default" engine="memory"
  237. comment="Temporary Indexer Table for price of downloadable products">
  238. <column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
  239. comment="Entity ID"/>
  240. <column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
  241. identity="false"/>
  242. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
  243. comment="Website ID"/>
  244. <column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="false"
  245. default="0" comment="Minimum price"/>
  246. <column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="false"
  247. default="0" comment="Maximum price"/>
  248. <constraint xsi:type="primary" referenceId="PRIMARY">
  249. <column name="entity_id"/>
  250. <column name="customer_group_id"/>
  251. <column name="website_id"/>
  252. </constraint>
  253. </table>
  254. </schema>