db_schema.xml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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="catalog_eav_attribute" resource="default" comment="Catalog EAV Attribute Table">
  11. <column xsi:type="text" name="additional_data" nullable="true" comment="Additional swatch attributes data"/>
  12. </table>
  13. <table name="eav_attribute_option_swatch" resource="default" engine="innodb" comment="Magento Swatches table">
  14. <column xsi:type="int" name="swatch_id" padding="10" unsigned="true" nullable="false" identity="true"
  15. comment="Swatch ID"/>
  16. <column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
  17. comment="Option ID"/>
  18. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  19. comment="Store ID"/>
  20. <column xsi:type="smallint" name="type" padding="5" unsigned="true" nullable="false" identity="false"
  21. comment="Swatch type: 0 - text, 1 - visual color, 2 - visual image"/>
  22. <column xsi:type="varchar" name="value" nullable="true" length="255" comment="Swatch Value"/>
  23. <constraint xsi:type="primary" referenceId="PRIMARY">
  24. <column name="swatch_id"/>
  25. </constraint>
  26. <constraint xsi:type="foreign" referenceId="EAV_ATTRIBUTE_OPTION_SWATCH_STORE_ID_STORE_STORE_ID"
  27. table="eav_attribute_option_swatch" column="store_id" referenceTable="store"
  28. referenceColumn="store_id" onDelete="CASCADE"/>
  29. <constraint xsi:type="foreign" referenceId="EAV_ATTR_OPT_SWATCH_OPT_ID_EAV_ATTR_OPT_OPT_ID"
  30. table="eav_attribute_option_swatch" column="option_id" referenceTable="eav_attribute_option"
  31. referenceColumn="option_id" onDelete="CASCADE"/>
  32. <constraint xsi:type="unique" referenceId="EAV_ATTRIBUTE_OPTION_SWATCH_STORE_ID_OPTION_ID">
  33. <column name="store_id"/>
  34. <column name="option_id"/>
  35. </constraint>
  36. <index referenceId="EAV_ATTRIBUTE_OPTION_SWATCH_SWATCH_ID" indexType="btree">
  37. <column name="swatch_id"/>
  38. </index>
  39. </table>
  40. </schema>