db_schema.xml 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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="search_query" resource="default" engine="innodb" comment="Search query table">
  11. <column xsi:type="int" name="query_id" padding="10" unsigned="true" nullable="false" identity="true"
  12. comment="Query ID"/>
  13. <column xsi:type="varchar" name="query_text" nullable="true" length="255" comment="Query text"/>
  14. <column xsi:type="int" name="num_results" padding="10" unsigned="true" nullable="false" identity="false"
  15. default="0" comment="Num results"/>
  16. <column xsi:type="int" name="popularity" padding="10" unsigned="true" nullable="false" identity="false"
  17. default="0" comment="Popularity"/>
  18. <column xsi:type="varchar" name="redirect" nullable="true" length="255" comment="Redirect"/>
  19. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  20. default="0" comment="Store ID"/>
  21. <column xsi:type="smallint" name="display_in_terms" padding="6" unsigned="false" nullable="false"
  22. identity="false" default="1" comment="Display in terms"/>
  23. <column xsi:type="smallint" name="is_active" padding="6" unsigned="false" nullable="true" identity="false"
  24. default="1" comment="Active status"/>
  25. <column xsi:type="smallint" name="is_processed" padding="6" unsigned="false" nullable="true" identity="false"
  26. default="0" comment="Processed status"/>
  27. <column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP"
  28. comment="Updated at"/>
  29. <constraint xsi:type="primary" referenceId="PRIMARY">
  30. <column name="query_id"/>
  31. </constraint>
  32. <constraint xsi:type="foreign" referenceId="SEARCH_QUERY_STORE_ID_STORE_STORE_ID" table="search_query"
  33. column="store_id" referenceTable="store" referenceColumn="store_id" onDelete="CASCADE"/>
  34. <constraint xsi:type="unique" referenceId="SEARCH_QUERY_QUERY_TEXT_STORE_ID">
  35. <column name="query_text"/>
  36. <column name="store_id"/>
  37. </constraint>
  38. <index referenceId="SEARCH_QUERY_QUERY_TEXT_STORE_ID_POPULARITY" indexType="btree">
  39. <column name="query_text"/>
  40. <column name="store_id"/>
  41. <column name="popularity"/>
  42. </index>
  43. <index referenceId="SEARCH_QUERY_STORE_ID" indexType="btree">
  44. <column name="store_id"/>
  45. </index>
  46. <index referenceId="SEARCH_QUERY_IS_PROCESSED" indexType="btree">
  47. <column name="is_processed"/>
  48. </index>
  49. </table>
  50. <table name="search_synonyms" resource="default" engine="innodb" comment="table storing various synonyms groups">
  51. <column xsi:type="bigint" name="group_id" padding="20" unsigned="true" nullable="false" identity="true"
  52. comment="Synonyms Group Id"/>
  53. <column xsi:type="text" name="synonyms" nullable="false" comment="list of synonyms making up this group"/>
  54. <column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false"
  55. default="0" comment="Store Id - identifies the store view these synonyms belong to"/>
  56. <column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
  57. default="0" comment="Website Id - identifies the website id these synonyms belong to"/>
  58. <constraint xsi:type="primary" referenceId="PRIMARY">
  59. <column name="group_id"/>
  60. </constraint>
  61. <constraint xsi:type="foreign" referenceId="SEARCH_SYNONYMS_STORE_ID_STORE_STORE_ID" table="search_synonyms"
  62. column="store_id" referenceTable="store" referenceColumn="store_id" onDelete="CASCADE"/>
  63. <constraint xsi:type="foreign" referenceId="SEARCH_SYNONYMS_WEBSITE_ID_STORE_WEBSITE_WEBSITE_ID"
  64. table="search_synonyms" column="website_id" referenceTable="store_website"
  65. referenceColumn="website_id" onDelete="CASCADE"/>
  66. <index referenceId="SEARCH_SYNONYMS_SYNONYMS" indexType="fulltext">
  67. <column name="synonyms"/>
  68. </index>
  69. <index referenceId="SEARCH_SYNONYMS_STORE_ID" indexType="btree">
  70. <column name="store_id"/>
  71. </index>
  72. <index referenceId="SEARCH_SYNONYMS_WEBSITE_ID" indexType="btree">
  73. <column name="website_id"/>
  74. </index>
  75. </table>
  76. </schema>