db_schema.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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="report_compared_product_index" resource="default" engine="innodb"
  11. comment="Reports Compared Product Index Table">
  12. <column xsi:type="bigint" name="index_id" padding="20" unsigned="true" nullable="false" identity="true"
  13. comment="Index Id"/>
  14. <column xsi:type="int" name="visitor_id" padding="10" unsigned="true" nullable="true" identity="false"
  15. comment="Visitor Id"/>
  16. <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="true" identity="false"
  17. comment="Customer Id"/>
  18. <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="false" identity="false"
  19. comment="Product Id"/>
  20. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  21. comment="Store Id"/>
  22. <column xsi:type="timestamp" name="added_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
  23. comment="Added At"/>
  24. <constraint xsi:type="primary" referenceId="PRIMARY">
  25. <column name="index_id"/>
  26. </constraint>
  27. <constraint xsi:type="foreign" referenceId="REPORT_CMPD_PRD_IDX_CSTR_ID_CSTR_ENTT_ENTT_ID"
  28. table="report_compared_product_index" column="customer_id" referenceTable="customer_entity"
  29. referenceColumn="entity_id" onDelete="CASCADE"/>
  30. <constraint xsi:type="foreign" referenceId="REPORT_CMPD_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
  31. table="report_compared_product_index" column="product_id" referenceTable="catalog_product_entity"
  32. referenceColumn="entity_id" onDelete="CASCADE"/>
  33. <constraint xsi:type="foreign" referenceId="REPORT_COMPARED_PRODUCT_INDEX_STORE_ID_STORE_STORE_ID"
  34. table="report_compared_product_index" column="store_id" referenceTable="store"
  35. referenceColumn="store_id" onDelete="SET NULL"/>
  36. <constraint xsi:type="unique" referenceId="REPORT_COMPARED_PRODUCT_INDEX_VISITOR_ID_PRODUCT_ID">
  37. <column name="visitor_id"/>
  38. <column name="product_id"/>
  39. </constraint>
  40. <constraint xsi:type="unique" referenceId="REPORT_COMPARED_PRODUCT_INDEX_CUSTOMER_ID_PRODUCT_ID">
  41. <column name="customer_id"/>
  42. <column name="product_id"/>
  43. </constraint>
  44. <index referenceId="REPORT_COMPARED_PRODUCT_INDEX_STORE_ID" indexType="btree">
  45. <column name="store_id"/>
  46. </index>
  47. <index referenceId="REPORT_COMPARED_PRODUCT_INDEX_ADDED_AT" indexType="btree">
  48. <column name="added_at"/>
  49. </index>
  50. <index referenceId="REPORT_COMPARED_PRODUCT_INDEX_PRODUCT_ID" indexType="btree">
  51. <column name="product_id"/>
  52. </index>
  53. </table>
  54. <table name="report_viewed_product_index" resource="default" engine="innodb"
  55. comment="Reports Viewed Product Index Table">
  56. <column xsi:type="bigint" name="index_id" padding="20" unsigned="true" nullable="false" identity="true"
  57. comment="Index Id"/>
  58. <column xsi:type="int" name="visitor_id" padding="10" unsigned="true" nullable="true" identity="false"
  59. comment="Visitor Id"/>
  60. <column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="true" identity="false"
  61. comment="Customer Id"/>
  62. <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="false" identity="false"
  63. comment="Product Id"/>
  64. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  65. comment="Store Id"/>
  66. <column xsi:type="timestamp" name="added_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
  67. comment="Added At"/>
  68. <constraint xsi:type="primary" referenceId="PRIMARY">
  69. <column name="index_id"/>
  70. </constraint>
  71. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_IDX_CSTR_ID_CSTR_ENTT_ENTT_ID"
  72. table="report_viewed_product_index" column="customer_id" referenceTable="customer_entity"
  73. referenceColumn="entity_id" onDelete="CASCADE"/>
  74. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
  75. table="report_viewed_product_index" column="product_id" referenceTable="catalog_product_entity"
  76. referenceColumn="entity_id" onDelete="CASCADE"/>
  77. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRODUCT_INDEX_STORE_ID_STORE_STORE_ID"
  78. table="report_viewed_product_index" column="store_id" referenceTable="store"
  79. referenceColumn="store_id" onDelete="SET NULL"/>
  80. <constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRODUCT_INDEX_VISITOR_ID_PRODUCT_ID">
  81. <column name="visitor_id"/>
  82. <column name="product_id"/>
  83. </constraint>
  84. <constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER_ID_PRODUCT_ID">
  85. <column name="customer_id"/>
  86. <column name="product_id"/>
  87. </constraint>
  88. <index referenceId="REPORT_VIEWED_PRODUCT_INDEX_STORE_ID" indexType="btree">
  89. <column name="store_id"/>
  90. </index>
  91. <index referenceId="REPORT_VIEWED_PRODUCT_INDEX_ADDED_AT" indexType="btree">
  92. <column name="added_at"/>
  93. </index>
  94. <index referenceId="REPORT_VIEWED_PRODUCT_INDEX_PRODUCT_ID" indexType="btree">
  95. <column name="product_id"/>
  96. </index>
  97. </table>
  98. <table name="report_event_types" resource="default" engine="innodb" comment="Reports Event Type Table">
  99. <column xsi:type="smallint" name="event_type_id" padding="5" unsigned="true" nullable="false" identity="true"
  100. comment="Event Type Id"/>
  101. <column xsi:type="varchar" name="event_name" nullable="false" length="64" comment="Event Name"/>
  102. <column xsi:type="smallint" name="customer_login" padding="5" unsigned="true" nullable="false" identity="false"
  103. default="0" comment="Customer Login"/>
  104. <constraint xsi:type="primary" referenceId="PRIMARY">
  105. <column name="event_type_id"/>
  106. </constraint>
  107. </table>
  108. <table name="report_event" resource="default" engine="innodb" comment="Reports Event Table">
  109. <column xsi:type="bigint" name="event_id" padding="20" unsigned="true" nullable="false" identity="true"
  110. comment="Event Id"/>
  111. <column xsi:type="timestamp" name="logged_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP"
  112. comment="Logged At"/>
  113. <column xsi:type="smallint" name="event_type_id" padding="5" unsigned="true" nullable="false" identity="false"
  114. default="0" comment="Event Type Id"/>
  115. <column xsi:type="int" name="object_id" padding="10" unsigned="true" nullable="false" identity="false"
  116. default="0" comment="Object Id"/>
  117. <column xsi:type="int" name="subject_id" padding="10" unsigned="true" nullable="false" identity="false"
  118. default="0" comment="Subject Id"/>
  119. <column xsi:type="smallint" name="subtype" padding="5" unsigned="true" nullable="false" identity="false"
  120. default="0" comment="Subtype"/>
  121. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  122. comment="Store Id"/>
  123. <constraint xsi:type="primary" referenceId="PRIMARY">
  124. <column name="event_id"/>
  125. </constraint>
  126. <constraint xsi:type="foreign" referenceId="REPORT_EVENT_STORE_ID_STORE_STORE_ID" table="report_event"
  127. column="store_id" referenceTable="store" referenceColumn="store_id" onDelete="CASCADE"/>
  128. <constraint xsi:type="foreign" referenceId="REPORT_EVENT_EVENT_TYPE_ID_REPORT_EVENT_TYPES_EVENT_TYPE_ID"
  129. table="report_event" column="event_type_id" referenceTable="report_event_types"
  130. referenceColumn="event_type_id" onDelete="CASCADE"/>
  131. <index referenceId="REPORT_EVENT_EVENT_TYPE_ID" indexType="btree">
  132. <column name="event_type_id"/>
  133. </index>
  134. <index referenceId="REPORT_EVENT_SUBJECT_ID" indexType="btree">
  135. <column name="subject_id"/>
  136. </index>
  137. <index referenceId="REPORT_EVENT_OBJECT_ID" indexType="btree">
  138. <column name="object_id"/>
  139. </index>
  140. <index referenceId="REPORT_EVENT_SUBTYPE" indexType="btree">
  141. <column name="subtype"/>
  142. </index>
  143. <index referenceId="REPORT_EVENT_STORE_ID" indexType="btree">
  144. <column name="store_id"/>
  145. </index>
  146. </table>
  147. <table name="report_viewed_product_aggregated_daily" resource="default" engine="innodb"
  148. comment="Most Viewed Products Aggregated Daily">
  149. <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
  150. <column xsi:type="date" name="period" comment="Period"/>
  151. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  152. comment="Store Id"/>
  153. <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="true" identity="false"
  154. comment="Product Id"/>
  155. <column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product Name"/>
  156. <column xsi:type="decimal" name="product_price" scale="4" precision="12" unsigned="false" nullable="false"
  157. default="0" comment="Product Price"/>
  158. <column xsi:type="int" name="views_num" padding="11" unsigned="false" nullable="false" identity="false"
  159. default="0" comment="Number of Views"/>
  160. <column xsi:type="smallint" name="rating_pos" padding="5" unsigned="true" nullable="false" identity="false"
  161. default="0" comment="Rating Pos"/>
  162. <constraint xsi:type="primary" referenceId="PRIMARY">
  163. <column name="id"/>
  164. </constraint>
  165. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_DAILY_STORE_ID_STORE_STORE_ID"
  166. table="report_viewed_product_aggregated_daily" column="store_id" referenceTable="store"
  167. referenceColumn="store_id" onDelete="CASCADE"/>
  168. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_AGGRED_DAILY_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
  169. table="report_viewed_product_aggregated_daily" column="product_id"
  170. referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
  171. <constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRD_AGGRED_DAILY_PERIOD_STORE_ID_PRD_ID">
  172. <column name="period"/>
  173. <column name="store_id"/>
  174. <column name="product_id"/>
  175. </constraint>
  176. <index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_DAILY_STORE_ID" indexType="btree">
  177. <column name="store_id"/>
  178. </index>
  179. <index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_DAILY_PRODUCT_ID" indexType="btree">
  180. <column name="product_id"/>
  181. </index>
  182. </table>
  183. <table name="report_viewed_product_aggregated_monthly" resource="default" engine="innodb"
  184. comment="Most Viewed Products Aggregated Monthly">
  185. <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
  186. <column xsi:type="date" name="period" comment="Period"/>
  187. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  188. comment="Store Id"/>
  189. <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="true" identity="false"
  190. comment="Product Id"/>
  191. <column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product Name"/>
  192. <column xsi:type="decimal" name="product_price" scale="4" precision="12" unsigned="false" nullable="false"
  193. default="0" comment="Product Price"/>
  194. <column xsi:type="int" name="views_num" padding="11" unsigned="false" nullable="false" identity="false"
  195. default="0" comment="Number of Views"/>
  196. <column xsi:type="smallint" name="rating_pos" padding="5" unsigned="true" nullable="false" identity="false"
  197. default="0" comment="Rating Pos"/>
  198. <constraint xsi:type="primary" referenceId="PRIMARY">
  199. <column name="id"/>
  200. </constraint>
  201. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_MONTHLY_STORE_ID_STORE_STORE_ID"
  202. table="report_viewed_product_aggregated_monthly" column="store_id" referenceTable="store"
  203. referenceColumn="store_id" onDelete="CASCADE"/>
  204. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_AGGRED_MONTHLY_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
  205. table="report_viewed_product_aggregated_monthly" column="product_id"
  206. referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
  207. <constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRD_AGGRED_MONTHLY_PERIOD_STORE_ID_PRD_ID">
  208. <column name="period"/>
  209. <column name="store_id"/>
  210. <column name="product_id"/>
  211. </constraint>
  212. <index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_MONTHLY_STORE_ID" indexType="btree">
  213. <column name="store_id"/>
  214. </index>
  215. <index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_MONTHLY_PRODUCT_ID" indexType="btree">
  216. <column name="product_id"/>
  217. </index>
  218. </table>
  219. <table name="report_viewed_product_aggregated_yearly" resource="default" engine="innodb"
  220. comment="Most Viewed Products Aggregated Yearly">
  221. <column xsi:type="int" name="id" padding="10" unsigned="true" nullable="false" identity="true" comment="Id"/>
  222. <column xsi:type="date" name="period" comment="Period"/>
  223. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="true" identity="false"
  224. comment="Store Id"/>
  225. <column xsi:type="int" name="product_id" padding="10" unsigned="true" nullable="true" identity="false"
  226. comment="Product Id"/>
  227. <column xsi:type="varchar" name="product_name" nullable="true" length="255" comment="Product Name"/>
  228. <column xsi:type="decimal" name="product_price" scale="4" precision="12" unsigned="false" nullable="false"
  229. default="0" comment="Product Price"/>
  230. <column xsi:type="int" name="views_num" padding="11" unsigned="false" nullable="false" identity="false"
  231. default="0" comment="Number of Views"/>
  232. <column xsi:type="smallint" name="rating_pos" padding="5" unsigned="true" nullable="false" identity="false"
  233. default="0" comment="Rating Pos"/>
  234. <constraint xsi:type="primary" referenceId="PRIMARY">
  235. <column name="id"/>
  236. </constraint>
  237. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_YEARLY_STORE_ID_STORE_STORE_ID"
  238. table="report_viewed_product_aggregated_yearly" column="store_id" referenceTable="store"
  239. referenceColumn="store_id" onDelete="CASCADE"/>
  240. <constraint xsi:type="foreign" referenceId="REPORT_VIEWED_PRD_AGGRED_YEARLY_PRD_ID_CAT_PRD_ENTT_ENTT_ID"
  241. table="report_viewed_product_aggregated_yearly" column="product_id"
  242. referenceTable="catalog_product_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
  243. <constraint xsi:type="unique" referenceId="REPORT_VIEWED_PRD_AGGRED_YEARLY_PERIOD_STORE_ID_PRD_ID">
  244. <column name="period"/>
  245. <column name="store_id"/>
  246. <column name="product_id"/>
  247. </constraint>
  248. <index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_YEARLY_STORE_ID" indexType="btree">
  249. <column name="store_id"/>
  250. </index>
  251. <index referenceId="REPORT_VIEWED_PRODUCT_AGGREGATED_YEARLY_PRODUCT_ID" indexType="btree">
  252. <column name="product_id"/>
  253. </index>
  254. </table>
  255. </schema>