Merge "Add namespace to maintenance/includes classes"
[mediawiki.git] / docs / abstract-schema-table.json
blobf86b11d1da1efabdb76a879ed41f60cf7a01f277
2         "$schema": "https://json-schema.org/schema#",
3         "description": "Abstract description of a mediawiki database table",
4         "type": "object",
5         "additionalProperties": false,
6         "properties": {
7                 "name": {
8                         "type": "string",
9                         "description": "Name of the table"
10                 },
11                 "comment": {
12                         "type": "string",
13                         "description": "Comment describing the table"
14                 },
15                 "columns": {
16                         "type": "array",
17                         "additionalItems": false,
18                         "description": "Columns",
19                         "minItems": 1,
20                         "items": {
21                                 "type": "object",
22                                 "additionalProperties": false,
23                                 "properties": {
24                                         "name": {
25                                                 "type": "string",
26                                                 "description": "Name of the column"
27                                         },
28                                         "comment": {
29                                                 "type": "string",
30                                                 "description": "Comment describing the column"
31                                         },
32                                         "type": {
33                                                 "type": "string",
34                                                 "description": "Data type of the column",
35                                                 "enum": [
36                                                         "bigint",
37                                                         "binary",
38                                                         "blob",
39                                                         "boolean",
40                                                         "datetimetz",
41                                                         "decimal",
42                                                         "float",
43                                                         "integer",
44                                                         "mwenum",
45                                                         "mwtimestamp",
46                                                         "mwtinyint",
47                                                         "smallint",
48                                                         "string",
49                                                         "text"
50                                                 ]
51                                         },
52                                         "options": {
53                                                 "type": "object",
54                                                 "description": "Additional options",
55                                                 "additionalProperties": false,
56                                                 "properties": {
57                                                         "autoincrement": {
58                                                                 "type": "boolean",
59                                                                 "description": "Indicates if the field should use an autoincremented value if no value was provided",
60                                                                 "default": false
61                                                         },
62                                                         "default": {
63                                                                 "type": [
64                                                                         "number",
65                                                                         "string",
66                                                                         "null"
67                                                                 ],
68                                                                 "description": "The default value of the column if no value was specified",
69                                                                 "default": null
70                                                         },
71                                                         "fixed": {
72                                                                 "type": "boolean",
73                                                                 "description": "Indicates if the column should have a fixed length",
74                                                                 "default": false
75                                                         },
76                                                         "length": {
77                                                                 "type": "number",
78                                                                 "description": "Length of the field.",
79                                                                 "default": null,
80                                                                 "minimum": 0
81                                                         },
82                                                         "notnull": {
83                                                                 "type": "boolean",
84                                                                 "description": "Indicates whether the column is nullable or not",
85                                                                 "default": true
86                                                         },
87                                                         "unsigned": {
88                                                                 "type": "boolean",
89                                                                 "description": "If the column should be an unsigned integer",
90                                                                 "default": false
91                                                         },
92                                                         "scale": {
93                                                                 "type": "number",
94                                                                 "description": "Exact number of decimal digits to be stored in a decimal type column",
95                                                                 "default": 0
96                                                         },
97                                                         "precision": {
98                                                                 "type": "number",
99                                                                 "description": "Precision of a decimal type column that determines the overall maximum number of digits to be stored (including scale)",
100                                                                 "default": 10
101                                                         },
102                                                         "PlatformOptions": {
103                                                                 "type": "object",
104                                                                 "additionalProperties": false,
105                                                                 "properties": {
106                                                                         "version": {
107                                                                                 "type": "boolean"
108                                                                         }
109                                                                 }
110                                                         },
111                                                         "CustomSchemaOptions": {
112                                                                 "type": "object",
113                                                                 "description": "Custom schema options",
114                                                                 "additionalProperties": false,
115                                                                 "properties": {
116                                                                         "allowInfinite": {
117                                                                                 "type": "boolean"
118                                                                         },
119                                                                         "doublePrecision": {
120                                                                                 "type": "boolean"
121                                                                         },
122                                                                         "enum_values": {
123                                                                                 "type": "array",
124                                                                                 "description": "Values to use with type 'mwenum'",
125                                                                                 "additionalItems": false,
126                                                                                 "items": {
127                                                                                         "type": "string"
128                                                                                 },
129                                                                                 "uniqueItems": true
130                                                                         }
131                                                                 }
132                                                         }
133                                                 }
134                                         }
135                                 },
136                                 "required": [
137                                         "name",
138                                         "type",
139                                         "options"
140                                 ]
141                         }
142                 },
143                 "indexes": {
144                         "type": "array",
145                         "additionalItems": false,
146                         "description": "Indexes",
147                         "items": {
148                                 "type": "object",
149                                 "additionalProperties": false,
150                                 "properties": {
151                                         "name": {
152                                                 "type": "string",
153                                                 "description": "Index name"
154                                         },
155                                         "comment": {
156                                                 "type": "string",
157                                                 "description": "Comment describing the index"
158                                         },
159                                         "columns": {
160                                                 "type": "array",
161                                                 "additionalItems": false,
162                                                 "description": "Columns used by the index",
163                                                 "items": {
164                                                         "type": "string"
165                                                 },
166                                                 "uniqueItems": true
167                                         },
168                                         "unique": {
169                                                 "type": "boolean",
170                                                 "description": "If the index is unique",
171                                                 "default": false
172                                         },
173                                         "flags": {
174                                                 "type": "array",
175                                                 "items": {
176                                                         "type": "string",
177                                                         "enum": [
178                                                                 "fulltext",
179                                                                 "spatial"
180                                                         ]
181                                                 },
182                                                 "uniqueItems": true
183                                         },
184                                         "options": {
185                                                 "type": "object",
186                                                 "properties": {
187                                                         "lengths": {
188                                                                 "type": "array",
189                                                                 "items": {
190                                                                         "type": [
191                                                                                 "number",
192                                                                                 "null"
193                                                                         ]
194                                                                 },
195                                                                 "minItems": 1
196                                                         }
197                                                 }
198                                         }
199                                 },
200                                 "required": [
201                                         "name",
202                                         "columns",
203                                         "unique"
204                                 ]
205                         }
206                 },
207                 "pk": {
208                         "type": "array",
209                         "additionalItems": false,
210                         "description": "Array of column names used in the primary key",
211                         "items": {
212                                 "type": "string"
213                         },
214                         "uniqueItems": true
215                 },
216                 "table_options": {
217                         "type": "array",
218                         "items": {
219                                 "type": "string"
220                         }
221                 }
222         },
223         "required": [
224                 "name",
225                 "columns",
226                 "indexes"
227         ]