schema.xsd 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  9. <!--Types-->
  10. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/name.xsd" />
  11. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/real/decimal.xsd" />
  12. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/real/float.xsd" />
  13. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/real/double.xsd" />
  14. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/integers/integer.xsd" />
  15. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/integers/biginteger.xsd" />
  16. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/integers/smallinteger.xsd" />
  17. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/integers/tinyinteger.xsd" />
  18. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/text.xsd" />
  19. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/longtext.xsd" />
  20. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/mediumtext.xsd" />
  21. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/texts/varchar.xsd" />
  22. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/blob.xsd" />
  23. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/mediumblob.xsd" />
  24. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/longblob.xsd" />
  25. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/binaries/varbinary.xsd" />
  26. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/datetime/timestamp.xsd" />
  27. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/datetime/datetime.xsd" />
  28. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/datetime/date.xsd" />
  29. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/boolean.xsd" />
  30. <!--Constraints-->
  31. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/constraints/foreign.xsd" />
  32. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/constraints/unique.xsd" />
  33. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/constraints/primary.xsd" />
  34. <!--Indexes-->
  35. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/index.xsd" />
  36. <xs:include schemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/types/column.xsd" />
  37. <xs:element name="schema">
  38. <xs:complexType>
  39. <xs:sequence minOccurs="0" maxOccurs="unbounded">
  40. <xs:element name="table" type="table">
  41. <xs:unique name="uniqueColumnName">
  42. <xs:annotation>
  43. <xs:documentation>Column name be unique for each table</xs:documentation>
  44. </xs:annotation>
  45. <xs:selector xpath="column" />
  46. <xs:field xpath="@name" />
  47. </xs:unique>
  48. <xs:unique name="uniqueIndexReferenceId">
  49. <xs:annotation>
  50. <xs:documentation>Reference ID should be unique for indexes</xs:documentation>
  51. </xs:annotation>
  52. <xs:selector xpath="index" />
  53. <xs:field xpath="@referenceId" />
  54. </xs:unique>
  55. <xs:unique name="uniqueConstraintReferenceId">
  56. <xs:annotation>
  57. <xs:documentation>Reference ID should be unique for constraints</xs:documentation>
  58. </xs:annotation>
  59. <xs:selector xpath="constraint" />
  60. <xs:field xpath="@referenceId" />
  61. </xs:unique>
  62. </xs:element>
  63. </xs:sequence>
  64. </xs:complexType>
  65. <xs:unique name="uniqueTableName">
  66. <xs:annotation>
  67. <xs:documentation>Table name should be unique for each module</xs:documentation>
  68. </xs:annotation>
  69. <xs:selector xpath="table" />
  70. <xs:field xpath="@name" />
  71. </xs:unique>
  72. </xs:element>
  73. <xs:complexType name="table">
  74. <xs:annotation>
  75. <xs:documentation>
  76. Table definition. Here we can found column, constraints and indexes
  77. </xs:documentation>
  78. </xs:annotation>
  79. <xs:choice minOccurs="0" maxOccurs="unbounded">
  80. <xs:element name="column" type="abstractColumnType"/>
  81. <xs:element name="constraint" />
  82. <xs:element name="index" type="index" />
  83. </xs:choice>
  84. <xs:attributeGroup ref="basicOperations" />
  85. <xs:attribute name="name" type="xs:string" use="required" />
  86. <xs:attribute name="resource" type="resourceType" />
  87. <xs:attribute name="engine" type="engineType" />
  88. <xs:attribute name="comment" type="xs:string" />
  89. <xs:attribute name="collation" type="xs:string" />
  90. <xs:attribute name="charset" type="xs:string" />
  91. <xs:attribute name="onCreate" type="xs:string" />
  92. </xs:complexType>
  93. <xs:simpleType name="resourceType">
  94. <xs:restriction base="xs:string">
  95. <xs:enumeration value="default" />
  96. <xs:enumeration value="checkout" />
  97. <xs:enumeration value="sales" />
  98. </xs:restriction>
  99. </xs:simpleType>
  100. <xs:simpleType name="engineType">
  101. <xs:restriction base="xs:string">
  102. <xs:enumeration value="innodb" />
  103. <xs:enumeration value="memory" />
  104. </xs:restriction>
  105. </xs:simpleType>
  106. </xs:schema>