db_schema.xml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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="widget" resource="default" engine="innodb" comment="Preconfigured Widgets">
  11. <column xsi:type="int" name="widget_id" padding="10" unsigned="true" nullable="false" identity="true"
  12. comment="Widget Id"/>
  13. <column xsi:type="varchar" name="widget_code" nullable="true" length="255"
  14. comment="Widget code for template directive"/>
  15. <column xsi:type="varchar" name="widget_type" nullable="true" length="255" comment="Widget Type"/>
  16. <column xsi:type="text" name="parameters" nullable="true" comment="Parameters"/>
  17. <constraint xsi:type="primary" referenceId="PRIMARY">
  18. <column name="widget_id"/>
  19. </constraint>
  20. <index referenceId="WIDGET_WIDGET_CODE" indexType="btree">
  21. <column name="widget_code"/>
  22. </index>
  23. </table>
  24. <table name="widget_instance" resource="default" engine="innodb" comment="Instances of Widget for Package Theme">
  25. <column xsi:type="int" name="instance_id" padding="10" unsigned="true" nullable="false" identity="true"
  26. comment="Instance Id"/>
  27. <column xsi:type="varchar" name="instance_type" nullable="true" length="255" comment="Instance Type"/>
  28. <column xsi:type="int" name="theme_id" padding="10" unsigned="true" nullable="false" identity="false"
  29. comment="Theme id"/>
  30. <column xsi:type="varchar" name="title" nullable="true" length="255" comment="Widget Title"/>
  31. <column xsi:type="varchar" name="store_ids" nullable="false" length="255" default="0" comment="Store ids"/>
  32. <column xsi:type="text" name="widget_parameters" nullable="true" comment="Widget parameters"/>
  33. <column xsi:type="smallint" name="sort_order" padding="5" unsigned="true" nullable="false" identity="false"
  34. default="0" comment="Sort order"/>
  35. <constraint xsi:type="primary" referenceId="PRIMARY">
  36. <column name="instance_id"/>
  37. </constraint>
  38. <constraint xsi:type="foreign" referenceId="WIDGET_INSTANCE_THEME_ID_THEME_THEME_ID" table="widget_instance"
  39. column="theme_id" referenceTable="theme" referenceColumn="theme_id" onDelete="CASCADE"/>
  40. </table>
  41. <table name="widget_instance_page" resource="default" engine="innodb" comment="Instance of Widget on Page">
  42. <column xsi:type="int" name="page_id" padding="10" unsigned="true" nullable="false" identity="true"
  43. comment="Page Id"/>
  44. <column xsi:type="int" name="instance_id" padding="10" unsigned="true" nullable="false" identity="false"
  45. default="0" comment="Instance Id"/>
  46. <column xsi:type="varchar" name="page_group" nullable="true" length="25" comment="Block Group Type"/>
  47. <column xsi:type="varchar" name="layout_handle" nullable="true" length="255" comment="Layout Handle"/>
  48. <column xsi:type="varchar" name="block_reference" nullable="true" length="255" comment="Container"/>
  49. <column xsi:type="varchar" name="page_for" nullable="true" length="25" comment="For instance entities"/>
  50. <column xsi:type="text" name="entities" nullable="true" comment="Catalog entities (comma separated)"/>
  51. <column xsi:type="varchar" name="page_template" nullable="true" length="255" comment="Path to widget template"/>
  52. <constraint xsi:type="primary" referenceId="PRIMARY">
  53. <column name="page_id"/>
  54. </constraint>
  55. <constraint xsi:type="foreign" referenceId="WIDGET_INSTANCE_PAGE_INSTANCE_ID_WIDGET_INSTANCE_INSTANCE_ID"
  56. table="widget_instance_page" column="instance_id" referenceTable="widget_instance"
  57. referenceColumn="instance_id" onDelete="CASCADE"/>
  58. <index referenceId="WIDGET_INSTANCE_PAGE_INSTANCE_ID" indexType="btree">
  59. <column name="instance_id"/>
  60. </index>
  61. </table>
  62. <table name="widget_instance_page_layout" resource="default" engine="innodb" comment="Layout updates">
  63. <column xsi:type="int" name="page_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"
  64. comment="Page Id"/>
  65. <column xsi:type="int" name="layout_update_id" padding="10" unsigned="true" nullable="false" identity="false"
  66. default="0" comment="Layout Update Id"/>
  67. <constraint xsi:type="foreign" referenceId="WIDGET_INSTANCE_PAGE_LAYOUT_PAGE_ID_WIDGET_INSTANCE_PAGE_PAGE_ID"
  68. table="widget_instance_page_layout" column="page_id" referenceTable="widget_instance_page"
  69. referenceColumn="page_id" onDelete="CASCADE"/>
  70. <constraint xsi:type="foreign" referenceId="WIDGET_INSTANCE_PAGE_LYT_LYT_UPDATE_ID_LYT_UPDATE_LYT_UPDATE_ID"
  71. table="widget_instance_page_layout" column="layout_update_id" referenceTable="layout_update"
  72. referenceColumn="layout_update_id" onDelete="CASCADE"/>
  73. <constraint xsi:type="unique" referenceId="WIDGET_INSTANCE_PAGE_LAYOUT_LAYOUT_UPDATE_ID_PAGE_ID">
  74. <column name="layout_update_id"/>
  75. <column name="page_id"/>
  76. </constraint>
  77. <index referenceId="WIDGET_INSTANCE_PAGE_LAYOUT_PAGE_ID" indexType="btree">
  78. <column name="page_id"/>
  79. </index>
  80. </table>
  81. <table name="layout_update" resource="default" engine="innodb" comment="Layout Updates">
  82. <column xsi:type="int" name="layout_update_id" padding="10" unsigned="true" nullable="false" identity="true"
  83. comment="Layout Update Id"/>
  84. <column xsi:type="varchar" name="handle" nullable="true" length="255" comment="Handle"/>
  85. <column xsi:type="text" name="xml" nullable="true" comment="Xml"/>
  86. <column xsi:type="smallint" name="sort_order" padding="6" unsigned="false" nullable="false" identity="false"
  87. default="0" comment="Sort Order"/>
  88. <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="true" default="0"
  89. comment="Last Update Timestamp"/>
  90. <constraint xsi:type="primary" referenceId="PRIMARY">
  91. <column name="layout_update_id"/>
  92. </constraint>
  93. <index referenceId="LAYOUT_UPDATE_HANDLE" indexType="btree">
  94. <column name="handle"/>
  95. </index>
  96. </table>
  97. <table name="layout_link" resource="default" engine="innodb" comment="Layout Link">
  98. <column xsi:type="int" name="layout_link_id" padding="10" unsigned="true" nullable="false" identity="true"
  99. comment="Link Id"/>
  100. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  101. default="0" comment="Store Id"/>
  102. <column xsi:type="int" name="theme_id" padding="10" unsigned="true" nullable="false" identity="false"
  103. comment="Theme id"/>
  104. <column xsi:type="int" name="layout_update_id" padding="10" unsigned="true" nullable="false" identity="false"
  105. default="0" comment="Layout Update Id"/>
  106. <column xsi:type="boolean" name="is_temporary" nullable="false" default="false"
  107. comment="Defines whether Layout Update is Temporary"/>
  108. <constraint xsi:type="primary" referenceId="PRIMARY">
  109. <column name="layout_link_id"/>
  110. </constraint>
  111. <constraint xsi:type="foreign" referenceId="LAYOUT_LINK_LAYOUT_UPDATE_ID_LAYOUT_UPDATE_LAYOUT_UPDATE_ID"
  112. table="layout_link" column="layout_update_id" referenceTable="layout_update"
  113. referenceColumn="layout_update_id" onDelete="CASCADE"/>
  114. <constraint xsi:type="foreign" referenceId="LAYOUT_LINK_STORE_ID_STORE_STORE_ID" table="layout_link" column="store_id"
  115. referenceTable="store" referenceColumn="store_id" onDelete="CASCADE"/>
  116. <constraint xsi:type="foreign" referenceId="LAYOUT_LINK_THEME_ID_THEME_THEME_ID" table="layout_link" column="theme_id"
  117. referenceTable="theme" referenceColumn="theme_id" onDelete="CASCADE"/>
  118. <index referenceId="LAYOUT_LINK_LAYOUT_UPDATE_ID" indexType="btree">
  119. <column name="layout_update_id"/>
  120. </index>
  121. <index referenceId="LAYOUT_LINK_STORE_ID_THEME_ID_LAYOUT_UPDATE_ID_IS_TEMPORARY" indexType="btree">
  122. <column name="store_id"/>
  123. <column name="theme_id"/>
  124. <column name="layout_update_id"/>
  125. <column name="is_temporary"/>
  126. </index>
  127. </table>
  128. </schema>