db_schema.xml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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="variable" resource="default" engine="innodb" comment="Variables">
  11. <column xsi:type="int" name="variable_id" padding="10" unsigned="true" nullable="false" identity="true"
  12. comment="Variable Id"/>
  13. <column xsi:type="varchar" name="code" nullable="true" length="255" comment="Variable Code"/>
  14. <column xsi:type="varchar" name="name" nullable="true" length="255" comment="Variable Name"/>
  15. <constraint xsi:type="primary" referenceId="PRIMARY">
  16. <column name="variable_id"/>
  17. </constraint>
  18. <constraint xsi:type="unique" referenceId="VARIABLE_CODE">
  19. <column name="code"/>
  20. </constraint>
  21. </table>
  22. <table name="variable_value" resource="default" engine="innodb" comment="Variable Value">
  23. <column xsi:type="int" name="value_id" padding="10" unsigned="true" nullable="false" identity="true"
  24. comment="Variable Value Id"/>
  25. <column xsi:type="int" name="variable_id" padding="10" unsigned="true" nullable="false" identity="false"
  26. default="0" comment="Variable Id"/>
  27. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  28. default="0" comment="Store Id"/>
  29. <column xsi:type="text" name="plain_value" nullable="true" comment="Plain Text Value"/>
  30. <column xsi:type="text" name="html_value" nullable="true" comment="Html Value"/>
  31. <constraint xsi:type="primary" referenceId="PRIMARY">
  32. <column name="value_id"/>
  33. </constraint>
  34. <constraint xsi:type="unique" referenceId="VARIABLE_VALUE_VARIABLE_ID_STORE_ID">
  35. <column name="variable_id"/>
  36. <column name="store_id"/>
  37. </constraint>
  38. <constraint xsi:type="foreign" referenceId="VARIABLE_VALUE_STORE_ID_STORE_STORE_ID" table="variable_value"
  39. column="store_id" referenceTable="store" referenceColumn="store_id" onDelete="CASCADE"/>
  40. <constraint xsi:type="foreign" referenceId="VARIABLE_VALUE_VARIABLE_ID_VARIABLE_VARIABLE_ID" table="variable_value"
  41. column="variable_id" referenceTable="variable" referenceColumn="variable_id" onDelete="CASCADE"/>
  42. <index referenceId="VARIABLE_VALUE_STORE_ID" indexType="btree">
  43. <column name="store_id"/>
  44. </index>
  45. </table>
  46. </schema>