2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3 elementFormDefault="qualified" attributeFormDefault="unqualified">
4 <xs:element name="database">
6 <xs:documentation>Database definition. These xml files were once
7 used for MDB2 which was a major source of bugs and
8 unmaintained. To keep compatibility the xml files definitions
9 are now parsed and used to create Doctrine schemas. To trigger
10 a database migration you need to increase your version number
16 <xs:element name="name" type="non-empty-string" minOccurs="0"
19 <xs:documentation>Value is ignored</xs:documentation>
22 <xs:element name="create" type="xs:boolean" minOccurs="0"
25 <xs:documentation>Value is ignored</xs:documentation>
28 <xs:element name="overwrite" type="xs:boolean" minOccurs="0"
31 <xs:documentation>Value is ignored</xs:documentation>
34 <xs:element name="charset" type="non-empty-string"
38 <xs:documentation>Value is ignored</xs:documentation>
41 <xs:element name="table" type="table" minOccurs="1"
42 maxOccurs="unbounded">
44 <xs:documentation>Each table contains a full database
54 <xs:simpleType name="non-empty-string">
55 <xs:restriction base="xs:string">
56 <xs:minLength value="1"/>
60 <xs:complexType name="table">
62 <xs:element name="name" type="non-empty-string" minOccurs="1"
65 <xs:documentation>Table name. You can and should use
66 *dbprefix* before your table, e.g.
67 *dbprefix*news_items. The value will be replaced with a
68 configurable prefix and defaults to "oc_"
72 <xs:element name="create" type="xs:boolean" minOccurs="0"
75 <xs:documentation>Value is ignored</xs:documentation>
78 <xs:element name="overwrite" type="xs:boolean" minOccurs="0"
81 <xs:documentation>Value is ignored</xs:documentation>
84 <xs:element name="charset" type="non-empty-string" minOccurs="0"
87 <xs:documentation>Value is ignored</xs:documentation>
90 <xs:element name="declaration" type="declaration" minOccurs="1"
93 <xs:documentation>Contains the actual database columns and
101 <xs:complexType name="declaration">
103 <xs:element name="field" type="field" minOccurs="0"
104 maxOccurs="unbounded">
106 <xs:documentation>A list of columns</xs:documentation>
109 <xs:element name="index" type="index" minOccurs="0"
110 maxOccurs="unbounded">
112 <xs:documentation>A list of indices on that table
119 <xs:complexType name="field">
121 <xs:element name="name" type="non-empty-string" minOccurs="1"
124 <xs:documentation>Column name</xs:documentation>
127 <xs:element name="type" type="field-type" minOccurs="1"
130 <xs:documentation>Column types. Certain types like integer
131 (aka smallint, integer, bigint), clob (aka text), text
132 (aka string), timestamp (aka datetime) and numeric (aka
133 decimal) are special to Nextcloud and will be
134 translated to their doctrine equivalents. Everything
135 else will be sent as is to doctrines type system. See
136 http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html
137 for a list of all types
141 <xs:element name="length" type="xs:int" minOccurs="0"
144 <xs:documentation>Length of the type. This will not only
145 define how long your text columns aka VARCHARs will be
146 set but also determine the size of the integer field:
147 < 4 will be transformed to smallint, 4 will be
148 transformed to integer and > 4 will be transformed
153 <xs:element name="unsigned" type="xs:boolean" minOccurs="0"
156 <xs:documentation>Can only be set for numeric values like
157 float, integer, etc. and will make them unsigned
161 <xs:element name="notnull" type="xs:boolean" minOccurs="0"
164 <xs:documentation>If a value should never be null
168 <xs:element name="autoincrement" type="xs:boolean" minOccurs="0"
171 <xs:documentation>Can only be set for primary keys
175 <xs:element name="default" type="xs:string" minOccurs="0"
178 <xs:documentation>Default value if given. Can also be empty
179 in which case the default will be an empty string.
183 <xs:element name="comments" type="non-empty-string" minOccurs="0"
186 <xs:documentation>Doctrine comment, can be ignored
190 <xs:element name="primary" type="xs:boolean" minOccurs="0"
193 <xs:documentation>True for the primary key. For composed
194 primary keys use a unique index.
198 <xs:element name="precision" type="xs:int" minOccurs="0"
201 <xs:documentation>Total number of digits for a
202 numerics/decimal type including decimal digits, e.g.
203 precision 3 and scale 2 will only allow 3.21 but not
208 <xs:element name="scale" type="xs:int" minOccurs="0"
211 <xs:documentation>Scale for a numeric/decimal type, e.g. 2
212 will save decimals with two decimal places: 3.21
219 <xs:simpleType name="field-type">
220 <xs:restriction base="xs:string">
221 <!-- smallint and bigint are set by setting a length smaller or bigger than 4 -->
222 <xs:enumeration value="integer"/>
223 <!-- clob equals text -->
224 <xs:enumeration value="clob"/>
225 <!-- text equals string -->
226 <xs:enumeration value="text"/>
227 <!-- timestamp equals datetime -->
228 <xs:enumeration value="timestamp"/>
229 <!-- numeric equals decimal -->
230 <xs:enumeration value="numeric"/>
231 <!-- doctrine types minus Nextcloud mappings-->
232 <xs:enumeration value="smallint"/>
233 <xs:enumeration value="bigint"/>
234 <xs:enumeration value="decimal"/>
235 <xs:enumeration value="float"/>
236 <xs:enumeration value="string"/>
237 <xs:enumeration value="text"/>
238 <xs:enumeration value="guid"/>
239 <xs:enumeration value="binary"/>
240 <xs:enumeration value="blob"/>
241 <xs:enumeration value="boolean"/>
242 <xs:enumeration value="date"/>
243 <xs:enumeration value="datetime"/>
244 <xs:enumeration value="datetimetz"/>
245 <xs:enumeration value="time"/>
246 <xs:enumeration value="dateinterval"/>
247 <xs:enumeration value="json"/>
248 <!-- object and arrays are not covered since support is bad -->
252 <xs:complexType name="index">
254 <xs:documentation>Element for defining indices. Can also be used to
255 define composite primary keys: simply add more than one field
256 to an index and define it as unique
260 <xs:element name="name" type="non-empty-string" minOccurs="1"
263 <xs:documentation>Index name. Should be unique
267 <xs:element name="primary" type="xs:boolean" minOccurs="0"
270 <xs:documentation>True if the index is in fact a primary
271 key. Will be ignored if the primary key is already set
276 <xs:element name="unique" type="xs:boolean" minOccurs="0"
279 <xs:documentation>If the index for the field or combination
280 of fields should be unique
284 <xs:element name="field" type="index-field" minOccurs="1"
285 maxOccurs="unbounded">
287 <xs:documentation>List of index fields that are used to
295 <xs:complexType name="index-field">
297 <xs:element name="name" type="non-empty-string" minOccurs="1"
300 <xs:documentation>Name of the column that should be
305 <xs:element name="sorting" type="index-sorting" minOccurs="0"
308 <xs:documentation>Value is ignored</xs:documentation>
314 <xs:simpleType name="index-sorting">
315 <xs:restriction base="xs:string">
316 <xs:enumeration value="ascending"/>
317 <xs:enumeration value="descending"/>