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