]> git.mxchange.org Git - friendica.git/blob - static/dbstructure.config.php
Merge pull request #8677 from MrPetovan/bug/8672-frio-contact-double-wrapping
[friendica.git] / static / dbstructure.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2020, Friendica
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  * Main database structure configuration file.
21  *
22  * Here are described all the tables, fields and indexes Friendica needs to work.
23  *
24  * Syntax (braces indicate optionale values):
25  * "<table name>" => [
26  *      "comment" => "Description of the table",
27  *      "fields" => [
28  *              "<field name>" => [
29  *                      "type" => "<field type>{(<field size>)} <unsigned>",
30  *                      "not null" => 0|1,
31  *                      {"extra" => "auto_increment",}
32  *                      {"default" => "<default value>",}
33  *                      {"default" => NULL_DATE,} (for datetime fields)
34  *                      {"primary" => "1",}
35  *                      {"foreign|relation" => ["<foreign key table name>" => "<foreign key field name>"],}
36  *                      "comment" => "Description of the fields"
37  *              ],
38  *              ...
39  *      ],
40  *      "indexes" => [
41  *              "PRIMARY" => ["<primary key field name>", ...],
42  *              "<index name>" => [{"UNIQUE",} "<field name>{(<key size>)}", ...]
43  *              ...
44  *      ],
45  * ],
46  *
47  * Whenever possible prefer "foreign" before "relation" with the foreign keys.
48  * "foreign" adds true foreign keys on the database level, while "relation" simulates this behaviour.
49  *
50  * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value below.
51  *
52  */
53
54 use Friendica\Database\DBA;
55
56 if (!defined('DB_UPDATE_VERSION')) {
57         define('DB_UPDATE_VERSION', 1349);
58 }
59
60 return [
61         // Side tables
62         "clients" => [
63                 "comment" => "OAuth usage",
64                 "fields" => [
65                         "client_id" => ["type" => "varchar(20)", "not null" => "1", "primary" => "1", "comment" => ""],
66                         "pw" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => ""],
67                         "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
68                         "name" => ["type" => "text", "comment" => ""],
69                         "icon" => ["type" => "text", "comment" => ""],
70                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
71                 ],
72                 "indexes" => [
73                         "PRIMARY" => ["client_id"],
74                 ]
75         ],
76         "contact" => [
77                 "comment" => "contact table",
78                 "fields" => [
79                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
80                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
81                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
82                         "updated" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Date of last contact update"],
83                         "self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 if the contact is the user him/her self"],
84                         "remote_self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
85                         "rel" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "The kind of the relation between the user and the contact"],
86                         "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
87                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network of the contact"],
88                         "protocol" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Protocol of the contact"],
89                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this contact is known by"],
90                         "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Nick- and user name of the contact"],
91                         "location" => ["type" => "varchar(255)", "default" => "", "comment" => ""],
92                         "about" => ["type" => "text", "comment" => ""],
93                         "keywords" => ["type" => "text", "comment" => "public keywords (interests) of the contact"],
94                         "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Deprecated"],
95                         "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
96                         "attag" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
97                         "avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
98                         "photo" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo of the contact"],
99                         "thumb" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo (thumb size)"],
100                         "micro" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo (micro size)"],
101                         "site-pubkey" => ["type" => "text", "comment" => ""],
102                         "issued-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
103                         "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
104                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
105                         "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
106                         "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
107                         "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
108                         "pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
109                         "prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
110                         "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
111                         "request" => ["type" => "varchar(255)", "comment" => ""],
112                         "notify" => ["type" => "varchar(255)", "comment" => ""],
113                         "poll" => ["type" => "varchar(255)", "comment" => ""],
114                         "confirm" => ["type" => "varchar(255)", "comment" => ""],
115                         "poco" => ["type" => "varchar(255)", "comment" => ""],
116                         "aes_allow" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
117                         "ret-aes" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
118                         "usehub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
119                         "subhub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
120                         "hub-verify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
121                         "last-update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last try to update the contact info"],
122                         "success_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last successful contact update"],
123                         "failure_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last failed update"],
124                         "name-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
125                         "uri-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
126                         "avatar-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
127                         "term-date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
128                         "last-item" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "date of the last post"],
129                         "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
130                         "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "Node-wide block status"],
131                         "block_reason" => ["type" => "text", "comment" => "Node-wide block reason"],
132                         "readonly" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "posts of the contact are readonly"],
133                         "writable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
134                         "forum" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a forum"],
135                         "prv" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a private group"],
136                         "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
137                         "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
138                         "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
139                         "pending" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
140                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact has been deleted"],
141                         "rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
142                         "unsearchable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact prefers to not be searchable"],
143                         "sensitive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Contact posts sensitive content"],
144                         "baseurl" => ["type" => "varchar(255)", "default" => "", "comment" => "baseurl of the contact"],
145                         "reason" => ["type" => "text", "comment" => ""],
146                         "closeness" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "99", "comment" => ""],
147                         "info" => ["type" => "mediumtext", "comment" => ""],
148                         "profile-id" => ["type" => "int unsigned", "comment" => "Deprecated"],
149                         "bdyear" => ["type" => "varchar(4)", "not null" => "1", "default" => "", "comment" => ""],
150                         "bd" => ["type" => "date", "not null" => "1", "default" => DBA::NULL_DATE, "comment" => ""],
151                         "notify_new_posts" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
152                         "fetch_further_information" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
153                         "ffi_keyword_blacklist" => ["type" => "text", "comment" => ""],
154                 ],
155                 "indexes" => [
156                         "PRIMARY" => ["id"],
157                         "uid_name" => ["uid", "name(190)"],
158                         "self_uid" => ["self", "uid"],
159                         "alias_uid" => ["alias(32)", "uid"],
160                         "pending_uid" => ["pending", "uid"],
161                         "blocked_uid" => ["blocked", "uid"],
162                         "uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"],
163                         "uid_network_batch" => ["uid", "network", "batch(64)"],
164                         "addr_uid" => ["addr(32)", "uid"],
165                         "nurl_uid" => ["nurl(32)", "uid"],
166                         "nick_uid" => ["nick(32)", "uid"],
167                         "dfrn-id" => ["dfrn-id(64)"],
168                         "issued-id" => ["issued-id(64)"],
169                 ]
170         ],
171         "item-uri" => [
172                 "comment" => "URI and GUID for items",
173                 "fields" => [
174                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
175                         "uri" => ["type" => "varbinary(255)", "not null" => "1", "comment" => "URI of an item"],
176                         "guid" => ["type" => "varbinary(255)", "comment" => "A unique identifier for an item"]
177                 ],
178                 "indexes" => [
179                         "PRIMARY" => ["id"],
180                         "uri" => ["UNIQUE", "uri"],
181                         "guid" => ["guid"]
182                 ]
183         ],
184         "permissionset" => [
185                 "comment" => "",
186                 "fields" => [
187                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
188                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner id of this permission set"],
189                         "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
190                         "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
191                         "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
192                         "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
193                 ],
194                 "indexes" => [
195                         "PRIMARY" => ["id"],
196                         "uid_allow_cid_allow_gid_deny_cid_deny_gid" => ["allow_cid(50)", "allow_gid(30)", "deny_cid(50)", "deny_gid(30)"],
197                 ]
198         ],
199         "tag" => [
200                 "comment" => "tags and mentions",
201                 "fields" => [
202                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
203                         "name" => ["type" => "varchar(96)", "not null" => "1", "default" => "", "comment" => ""],
204                         "url" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""]
205                 ],
206                 "indexes" => [
207                         "PRIMARY" => ["id"],
208                         "type_name_url" => ["UNIQUE", "name", "url"],
209                         "url" => ["url"]
210                 ]
211         ],
212         // Main tables
213         "2fa_app_specific_password" => [
214                 "comment" => "Two-factor app-specific _password",
215                 "fields" => [
216                         "id" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Password ID for revocation"],
217                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "relation" => ["user" => "uid"], "comment" => "User ID"],
218                         "description" => ["type" => "varchar(255)", "comment" => "Description of the usage of the password"],
219                         "hashed_password" => ["type" => "varchar(255)", "not null" => "1", "comment" => "Hashed password"],
220                         "generated" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the password was generated"],
221                         "last_used" => ["type" => "datetime", "comment" => "Datetime the password was last used"],
222                 ],
223                 "indexes" => [
224                         "PRIMARY" => ["id"],
225                         "uid_description" => ["uid", "description(190)"],
226                 ]
227         ],
228         "2fa_recovery_codes" => [
229                 "comment" => "Two-factor authentication recovery codes",
230                 "fields" => [
231                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User ID"],
232                         "code" => ["type" => "varchar(50)", "not null" => "1", "primary" => "1", "comment" => "Recovery code string"],
233                         "generated" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the code was generated"],
234                         "used" => ["type" => "datetime", "comment" => "Datetime the code was used"],
235                 ],
236                 "indexes" => [
237                         "PRIMARY" => ["uid", "code"]
238                 ]
239         ],
240         "addon" => [
241                 "comment" => "registered addons",
242                 "fields" => [
243                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
244                         "name" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "addon base (file)name"],
245                         "version" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "currently unused"],
246                         "installed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently always 1"],
247                         "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently unused"],
248                         "timestamp" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "file timestamp to check for reloads"],
249                         "plugin_admin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = has admin config, 0 = has no admin config"],
250                 ],
251                 "indexes" => [
252                         "PRIMARY" => ["id"],
253                         "name" => ["UNIQUE", "name"],
254                 ]
255         ],
256         "apcontact" => [
257                 "comment" => "ActivityPub compatible contacts - used in the ActivityPub implementation",
258                 "fields" => [
259                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URL of the contact"],
260                         "uuid" => ["type" => "varchar(255)", "comment" => ""],
261                         "type" => ["type" => "varchar(20)", "not null" => "1", "comment" => ""],
262                         "following" => ["type" => "varchar(255)", "comment" => ""],
263                         "followers" => ["type" => "varchar(255)", "comment" => ""],
264                         "inbox" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
265                         "outbox" => ["type" => "varchar(255)", "comment" => ""],
266                         "sharedinbox" => ["type" => "varchar(255)", "comment" => ""],
267                         "manually-approve" => ["type" => "boolean", "comment" => ""],
268                         "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
269                         "name" => ["type" => "varchar(255)", "comment" => ""],
270                         "about" => ["type" => "text", "comment" => ""],
271                         "photo" => ["type" => "varchar(255)", "comment" => ""],
272                         "addr" => ["type" => "varchar(255)", "comment" => ""],
273                         "alias" => ["type" => "varchar(255)", "comment" => ""],
274                         "pubkey" => ["type" => "text", "comment" => ""],
275                         "baseurl" => ["type" => "varchar(255)", "comment" => "baseurl of the ap contact"],
276                         "generator" => ["type" => "varchar(255)", "comment" => "Name of the contact's system"],
277                         "following_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of following contacts"],
278                         "followers_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of followers"],
279                         "statuses_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of posts"],
280                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
281                 ],
282                 "indexes" => [
283                         "PRIMARY" => ["url"],
284                         "addr" => ["addr(32)"],
285                         "alias" => ["alias(190)"],
286                         "url" => ["followers(190)"]
287                 ]
288         ],
289         "attach" => [
290                 "comment" => "file attachments",
291                 "fields" => [
292                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "generated index"],
293                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
294                         "hash" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "hash"],
295                         "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "filename of original"],
296                         "filetype" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "mimetype"],
297                         "filesize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "size in bytes"],
298                         "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"],
299                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
300                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
301                         "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>"],
302                         "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
303                         "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
304                         "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
305                         "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
306                         "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
307                 ],
308                 "indexes" => [
309                         "PRIMARY" => ["id"],
310                 ]
311         ],
312         "auth_codes" => [
313                 "comment" => "OAuth usage",
314                 "fields" => [
315                         "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
316                         "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"],
317                                 "comment" => ""],
318                         "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
319                         "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
320                         "scope" => ["type" => "varchar(250)", "not null" => "1", "default" => "", "comment" => ""],
321                 ],
322                 "indexes" => [
323                         "PRIMARY" => ["id"],
324                         "client_id" => ["client_id"]
325                 ]
326         ],
327         "cache" => [
328                 "comment" => "Stores temporary data",
329                 "fields" => [
330                         "k" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "cache key"],
331                         "v" => ["type" => "mediumtext", "comment" => "cached serialized value"],
332                         "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
333                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache insertion"],
334                 ],
335                 "indexes" => [
336                         "PRIMARY" => ["k"],
337                         "k_expires" => ["k", "expires"],
338                 ]
339         ],
340         "challenge" => [
341                 "comment" => "",
342                 "fields" => [
343                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
344                         "challenge" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
345                         "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
346                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
347                         "type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
348                         "last_update" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
349                 ],
350                 "indexes" => [
351                         "PRIMARY" => ["id"],
352                 ]
353         ],
354         "config" => [
355                 "comment" => "main configuration storage",
356                 "fields" => [
357                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
358                         "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
359                         "k" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
360                         "v" => ["type" => "mediumtext", "comment" => ""],
361                 ],
362                 "indexes" => [
363                         "PRIMARY" => ["id"],
364                         "cat_k" => ["UNIQUE", "cat", "k"],
365                 ]
366         ],
367         "contact-relation" => [
368                 "comment" => "Contact relations",
369                 "fields" => [
370                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "primary" => "1", "comment" => "contact the related contact had interacted with"],
371                         "relation-cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "primary" => "1", "comment" => "related contact who had interacted with the contact"],
372                         "last-interaction" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last interaction"],
373                 ],
374                 "indexes" => [
375                         "PRIMARY" => ["cid", "relation-cid"],
376                         "relation-cid" => ["relation-cid"],
377                 ]
378         ],
379         "conv" => [
380                 "comment" => "private messages",
381                 "fields" => [
382                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
383                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this conversation"],
384                         "recips" => ["type" => "text", "comment" => "sender_handle;recipient_handle"],
385                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
386                         "creator" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "handle of creator"],
387                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation timestamp"],
388                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "edited timestamp"],
389                         "subject" => ["type" => "text", "comment" => "subject of initial message"],
390                 ],
391                 "indexes" => [
392                         "PRIMARY" => ["id"],
393                         "uid" => ["uid"],
394                 ]
395         ],
396         "conversation" => [
397                 "comment" => "Raw data and structure information for messages",
398                 "fields" => [
399                         "item-uri" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "Original URI of the item - unrelated to the table with the same name"],
400                         "reply-to-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "URI to which this item is a reply"],
401                         "conversation-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation URI"],
402                         "conversation-href" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation link"],
403                         "protocol" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "255", "comment" => "The protocol of the item"],
404                         "direction" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "How the message arrived here: 1=push, 2=pull"],
405                         "source" => ["type" => "mediumtext", "comment" => "Original source"],
406                         "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Receiving date"],
407                 ],
408                 "indexes" => [
409                         "PRIMARY" => ["item-uri"],
410                         "conversation-uri" => ["conversation-uri"],
411                         "received" => ["received"],
412                 ]
413         ],
414         "diaspora-interaction" => [
415                 "comment" => "Signed Diaspora Interaction",
416                 "fields" => [
417                         "uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
418                         "interaction" => ["type" => "mediumtext", "comment" => "The Diaspora interaction"]
419                 ],
420                 "indexes" => [
421                         "PRIMARY" => ["uri-id"]
422                 ]
423         ],
424         "event" => [
425                 "comment" => "Events",
426                 "fields" => [
427                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
428                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
429                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
430                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact_id (ID of the contact in contact table)"],
431                         "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
432                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
433                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
434                         "start" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event start time"],
435                         "finish" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event end time"],
436                         "summary" => ["type" => "text", "comment" => "short description or title of the event"],
437                         "desc" => ["type" => "text", "comment" => "event description"],
438                         "location" => ["type" => "text", "comment" => "event location"],
439                         "type" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => "event or birthday"],
440                         "nofinish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if event does have no end this is 1"],
441                         "adjust" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "adjust to timezone of the recipient (0 or 1)"],
442                         "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "0 or 1"],
443                         "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
444                         "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
445                         "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
446                         "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
447                 ],
448                 "indexes" => [
449                         "PRIMARY" => ["id"],
450                         "uid_start" => ["uid", "start"],
451                 ]
452         ],
453         "fcontact" => [
454                 "comment" => "Diaspora compatible contacts - used in the Diaspora implementation",
455                 "fields" => [
456                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
457                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "unique id"],
458                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
459                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
460                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
461                         "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
462                         "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
463                         "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
464                         "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
465                         "notify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
466                         "poll" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
467                         "confirm" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
468                         "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
469                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
470                         "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
471                         "pubkey" => ["type" => "text", "comment" => ""],
472                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
473                 ],
474                 "indexes" => [
475                         "PRIMARY" => ["id"],
476                         "addr" => ["addr(32)"],
477                         "url" => ["UNIQUE", "url(190)"],
478                 ]
479         ],
480         "fsuggest" => [
481                 "comment" => "friend suggestion stuff",
482                 "fields" => [
483                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
484                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
485                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
486                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
487                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
488                         "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
489                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
490                         "note" => ["type" => "text", "comment" => ""],
491                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
492                 ],
493                 "indexes" => [
494                         "PRIMARY" => ["id"],
495                 ]
496         ],
497         "gcign" => [
498                 "comment" => "contacts ignored by friend suggestions",
499                 "fields" => [
500                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
501                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Local User id"],
502                         "gcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => "gcontact.id of ignored contact"],
503                 ],
504                 "indexes" => [
505                         "PRIMARY" => ["id"],
506                         "uid" => ["uid"],
507                         "gcid" => ["gcid"],
508                 ]
509         ],
510         "gcontact" => [
511                 "comment" => "global contacts",
512                 "fields" => [
513                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
514                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this contact is known by"],
515                         "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Nick- and user name of the contact"],
516                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the contacts profile page"],
517                         "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
518                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the profile photo"],
519                         "connect" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
520                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
521                         "updated" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
522                         "last_contact" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
523                         "last_failure" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
524                         "last_discovery" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last contact discovery"],
525                         "archive_date" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
526                         "archived" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
527                         "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
528                         "about" => ["type" => "text", "comment" => ""],
529                         "keywords" => ["type" => "text", "comment" => "puplic keywords (interests)"],
530                         "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Deprecated"],
531                         "birthday" => ["type" => "varchar(32)", "not null" => "1", "default" => DBA::NULL_DATE, "comment" => ""],
532                         "community" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 if contact is forum account"],
533                         "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "-1", "comment" => ""],
534                         "hide" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = should be hidden from search"],
535                         "nsfw" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = contact posts nsfw content"],
536                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "social network protocol"],
537                         "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
538                         "notify" => ["type" => "varchar(255)", "comment" => ""],
539                         "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
540                         "generation" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
541                         "server_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "baseurl of the contacts server"],
542                 ],
543                 "indexes" => [
544                         "PRIMARY" => ["id"],
545                         "nurl" => ["UNIQUE", "nurl(190)"],
546                         "name" => ["name(64)"],
547                         "nick" => ["nick(32)"],
548                         "addr" => ["addr(64)"],
549                         "hide_network_updated" => ["hide", "network", "updated"],
550                         "updated" => ["updated"],
551                 ]
552         ],
553         "gfollower" => [
554                 "comment" => "Followers of global contacts",
555                 "fields" => [
556                         "gcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["gcontact" => "id"], "comment" => "global contact"],
557                         "follower-gcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["gcontact" => "id"], "comment" => "global contact of the follower"],
558                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates that the connection has been deleted"],
559                 ],
560                 "indexes" => [
561                         "PRIMARY" => ["gcid", "follower-gcid"],
562                         "follower-gcid" => ["follower-gcid"],
563                 ]
564         ],
565         "glink" => [
566                 "comment" => "'friends of friends' linkages derived from poco",
567                 "fields" => [
568                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
569                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
570                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
571                         "gcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
572                         "zcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
573                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
574                 ],
575                 "indexes" => [
576                         "PRIMARY" => ["id"],
577                         "cid_uid_gcid_zcid" => ["UNIQUE", "cid", "uid", "gcid", "zcid"],
578                         "gcid" => ["gcid"],
579                 ]
580         ],
581         "group" => [
582                 "comment" => "privacy groups, group info",
583                 "fields" => [
584                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
585                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
586                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the member list is not private"],
587                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the group has been deleted"],
588                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "human readable name of group"],
589                 ],
590                 "indexes" => [
591                         "PRIMARY" => ["id"],
592                         "uid" => ["uid"],
593                 ]
594         ],
595         "group_member" => [
596                 "comment" => "privacy groups, member info",
597                 "fields" => [
598                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
599                         "gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["group" => "id"], "comment" => "groups.id of the associated group"],
600                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id of the member assigned to the associated group"],
601                 ],
602                 "indexes" => [
603                         "PRIMARY" => ["id"],
604                         "contactid" => ["contact-id"],
605                         "gid_contactid" => ["UNIQUE", "gid", "contact-id"],
606                 ]
607         ],
608         "gserver" => [
609                 "comment" => "Global servers",
610                 "fields" => [
611                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
612                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
613                         "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
614                         "version" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
615                         "site_name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
616                         "info" => ["type" => "text", "comment" => ""],
617                         "register_policy" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
618                         "registered-users" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Number of registered users"],
619                         "directory-type" => ["type" => "tinyint", "default" => "0", "comment" => "Type of directory service (Poco, Mastodon)"],
620                         "poco" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
621                         "noscrape" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
622                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
623                         "platform" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
624                         "relay-subscribe" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Has the server subscribed to the relay system"],
625                         "relay-scope" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => "The scope of messages that the server wants to get"],
626                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
627                         "last_poco_query" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
628                         "last_contact" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
629                         "last_failure" => ["type" => "datetime", "default" => DBA::NULL_DATETIME, "comment" => ""],
630                 ],
631                 "indexes" => [
632                         "PRIMARY" => ["id"],
633                         "nurl" => ["UNIQUE", "nurl(190)"],
634                 ]
635         ],
636         "gserver-tag" => [
637                 "comment" => "Tags that the server has subscribed",
638                 "fields" => [
639                         "gserver-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gserver" => "id"], "primary" => "1",
640                                 "comment" => "The id of the gserver"],
641                         "tag" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "primary" => "1", "comment" => "Tag that the server has subscribed"],
642                 ],
643                 "indexes" => [
644                         "PRIMARY" => ["gserver-id", "tag"],
645                         "tag" => ["tag"],
646                 ]
647         ],
648         "hook" => [
649                 "comment" => "addon hook registry",
650                 "fields" => [
651                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
652                         "hook" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => "name of hook"],
653                         "file" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "relative filename of hook handler"],
654                         "function" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "function name of hook handler"],
655                         "priority" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => "not yet implemented - can be used to sort conflicts in hook handling by calling handlers in priority order"],
656                 ],
657                 "indexes" => [
658                         "PRIMARY" => ["id"],
659                         "hook_file_function" => ["UNIQUE", "hook", "file", "function"],
660                 ]
661         ],
662         "inbox-status" => [
663                 "comment" => "Status of ActivityPub inboxes",
664                 "fields" => [
665                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URL of the inbox"],
666                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date of this entry"],
667                         "success" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last successful delivery"],
668                         "failure" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last failed delivery"],
669                         "previous" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Previous delivery date"],
670                         "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the inbox archived?"],
671                         "shared" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is it a shared inbox?"]
672                 ],
673                 "indexes" => [
674                         "PRIMARY" => ["url"]
675                 ]
676         ],
677         "intro" => [
678                 "comment" => "",
679                 "fields" => [
680                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
681                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
682                         "fid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["fcontact" => "id"], "comment" => ""],
683                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
684                         "knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
685                         "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
686                         "note" => ["type" => "text", "comment" => ""],
687                         "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
688                         "datetime" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
689                         "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
690                         "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
691                 ],
692                 "indexes" => [
693                         "PRIMARY" => ["id"],
694                 ]
695         ],
696         "item" => [
697                 "comment" => "Structure for all posts",
698                 "fields" => [
699                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => ["thread" => "iid"]],
700                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this item"],
701                         "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
702                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
703                         "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
704                         "parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id of the parent to this item if it is a reply of some form; otherwise this must be set to the id of this item"],
705                         "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "uri of the parent to this item"],
706                         "parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table that contains the parent uri"],
707                         "thr-parent" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "If the parent of this item is not the top-level item in the conversation, the uri of the immediate parent; otherwise set to parent-uri"],
708                         "thr-parent-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table that contains the thread parent uri"],
709                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation timestamp."],
710                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last edit (default is created)"],
711                         "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last comment/reply to this item"],
712                         "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime"],
713                         "changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date that something in the conversation changed, indicating clients should fetch the conversation again"],
714                         "gravity" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
715                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network from where the item comes from"],
716                         "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
717                         "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
718                         "icid" => ["type" => "int unsigned", "relation" => ["item-content" => "id"], "comment" => "Id of the item-content table entry that contains the whole item content"],
719                         "iaid" => ["type" => "int unsigned", "relation" => ["item-activity" => "id"], "comment" => "Id of the item-activity table entry that contains the activity data"],
720                         "vid" => ["type" => "smallint unsigned", "relation" => ["verb" => "id"], "comment" => "Id of the verb table entry that contains the activity verbs"],
721                         "extid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
722                         "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
723                         "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
724                         "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
725                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
726                         "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
727                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been deleted"],
728                         // User specific fields. Eventually they will move to user-item
729                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
730                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id"],
731                         "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "This item was posted to the wall of uid"],
732                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item originated at this site"],
733                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
734                         "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been favourited"],
735                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "item has not been seen"],
736                         "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "The owner of this item was mentioned in it"],
737                         "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
738                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this post"],
739                         // It has to be decided whether these fields belong to the user or the structure
740                         "resource-id" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type"],
741                         "event-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
742                         // Could possibly be replaced by the "attach" table?
743                         "attach" => ["type" => "mediumtext", "comment" => "JSON structure representing attachments to this item"],
744                         // Deprecated fields. Will be removed in upcoming versions
745                         "allow_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
746                         "allow_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
747                         "deny_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
748                         "deny_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
749                         "postopts" => ["type" => "text", "comment" => "Deprecated"],
750                         "inform" => ["type" => "mediumtext", "comment" => "Deprecated"],
751                         "type" => ["type" => "varchar(20)", "comment" => "Deprecated"],
752                         "bookmark" => ["type" => "boolean", "comment" => "Deprecated"],
753                         "file" => ["type" => "mediumtext", "comment" => "Deprecated"],
754                         "location" => ["type" => "varchar(255)", "comment" => "Deprecated"],
755                         "coord" => ["type" => "varchar(255)", "comment" => "Deprecated"],
756                         "tag" => ["type" => "mediumtext", "comment" => "Deprecated"],
757                         "plink" => ["type" => "varchar(255)", "comment" => "Deprecated"],
758                         "title" => ["type" => "varchar(255)", "comment" => "Deprecated"],
759                         "content-warning" => ["type" => "varchar(255)", "comment" => "Deprecated"],
760                         "body" => ["type" => "mediumtext", "comment" => "Deprecated"],
761                         "app" => ["type" => "varchar(255)", "comment" => "Deprecated"],
762                         "verb" => ["type" => "varchar(100)", "comment" => "Deprecated"],
763                         "object-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
764                         "object" => ["type" => "text", "comment" => "Deprecated"],
765                         "target-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
766                         "target" => ["type" => "text", "comment" => "Deprecated"],
767                         "author-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
768                         "author-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
769                         "author-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
770                         "owner-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
771                         "owner-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
772                         "owner-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
773                         "rendered-hash" => ["type" => "varchar(32)", "comment" => "Deprecated"],
774                         "rendered-html" => ["type" => "mediumtext", "comment" => "Deprecated"],
775                 ],
776                 "indexes" => [
777                         "PRIMARY" => ["id"],
778                         "guid" => ["guid(191)"],
779                         "uri" => ["uri(191)"],
780                         "parent" => ["parent"],
781                         "parent-uri" => ["parent-uri(191)"],
782                         "extid" => ["extid(191)"],
783                         "uid_id" => ["uid", "id"],
784                         "uid_contactid_id" => ["uid", "contact-id", "id"],
785                         "uid_received" => ["uid", "received"],
786                         "uid_commented" => ["uid", "commented"],
787                         "uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
788                         "uid_network_received" => ["uid", "network", "received"],
789                         "uid_network_commented" => ["uid", "network", "commented"],
790                         "uid_thrparent" => ["uid", "thr-parent(190)"],
791                         "uid_parenturi" => ["uid", "parent-uri(190)"],
792                         "uid_contactid_received" => ["uid", "contact-id", "received"],
793                         "authorid_received" => ["author-id", "received"],
794                         "ownerid" => ["owner-id"],
795                         "contact-id" => ["contact-id"],
796                         "uid_uri" => ["uid", "uri(190)"],
797                         "resource-id" => ["resource-id"],
798                         "deleted_changed" => ["deleted", "changed"],
799                         "uid_wall_changed" => ["uid", "wall", "changed"],
800                         "mention_uid_id" => ["mention", "uid", "id"],
801                         "uid_eventid" => ["uid", "event-id"],
802                         "icid" => ["icid"],
803                         "iaid" => ["iaid"],
804                         "psid_wall" => ["psid", "wall"],
805                         "uri-id" => ["uri-id"],
806                         "parent-uri-id" => ["parent-uri-id"],
807                         "thr-parent-id" => ["thr-parent-id"],
808                 ]
809         ],
810         "item-activity" => [
811                 "comment" => "Activities for items",
812                 "fields" => [
813                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
814                         "uri" => ["type" => "varchar(255)", "comment" => ""],
815                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
816                         "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
817                         "activity" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""]
818                 ],
819                 "indexes" => [
820                         "PRIMARY" => ["id"],
821                         "uri-hash" => ["UNIQUE", "uri-hash"],
822                         "uri" => ["uri(191)"],
823                         "uri-id" => ["uri-id"]
824                 ]
825         ],
826         "item-content" => [
827                 "comment" => "Content for all posts",
828                 "fields" => [
829                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
830                         "uri" => ["type" => "varchar(255)", "comment" => ""],
831                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
832                         "uri-plink-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
833                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
834                         "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
835                         "body" => ["type" => "mediumtext", "comment" => "item body content"],
836                         "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
837                         "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
838                         "language" => ["type" => "text", "comment" => "Language information about this post"],
839                         "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
840                         "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
841                         "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
842                         "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
843                         "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
844                         "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
845                         "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
846                         "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
847                         "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams verb"]
848                 ],
849                 "indexes" => [
850                         "PRIMARY" => ["id"],
851                         "uri-plink-hash" => ["UNIQUE", "uri-plink-hash"],
852                         "uri" => ["uri(191)"],
853                         "plink" => ["plink(191)"],
854                         "uri-id" => ["uri-id"]
855                 ]
856         ],
857         "locks" => [
858                 "comment" => "",
859                 "fields" => [
860                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
861                         "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
862                         "locked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
863                         "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process ID"],
864                         "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
865                 ],
866                 "indexes" => [
867                         "PRIMARY" => ["id"],
868                         "name_expires" => ["name", "expires"]
869                 ]
870         ],
871         "mail" => [
872                 "comment" => "private messages",
873                 "fields" => [
874                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
875                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
876                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this private message"],
877                         "from-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "name of the sender"],
878                         "from-photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "contact photo link of the sender"],
879                         "from-url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "profile linke of the sender"],
880                         "contact-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => ["contact" => "id"], "comment" => "contact.id"],
881                         "convid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["conv" => "id"], "comment" => "conv.id"],
882                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
883                         "body" => ["type" => "mediumtext", "comment" => ""],
884                         "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if message visited it is 1"],
885                         "reply" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
886                         "replied" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
887                         "unknown" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if sender not in the contact table this is 1"],
888                         "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
889                         "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
890                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time of the private message"],
891                 ],
892                 "indexes" => [
893                         "PRIMARY" => ["id"],
894                         "uid_seen" => ["uid", "seen"],
895                         "convid" => ["convid"],
896                         "uri" => ["uri(64)"],
897                         "parent-uri" => ["parent-uri(64)"],
898                         "contactid" => ["contact-id(32)"],
899                 ]
900         ],
901         "mailacct" => [
902                 "comment" => "Mail account data for fetching mails",
903                 "fields" => [
904                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
905                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
906                         "server" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
907                         "port" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
908                         "ssltype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
909                         "mailbox" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
910                         "user" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
911                         "pass" => ["type" => "text", "comment" => ""],
912                         "reply_to" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
913                         "action" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
914                         "movetofolder" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
915                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
916                         "last_check" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
917                 ],
918                 "indexes" => [
919                         "PRIMARY" => ["id"],
920                 ]
921         ],
922         "manage" => [
923                 "comment" => "table of accounts that can manage each other",
924                 "fields" => [
925                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
926                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
927                         "mid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
928                 ],
929                 "indexes" => [
930                         "PRIMARY" => ["id"],
931                         "uid_mid" => ["UNIQUE", "uid", "mid"],
932                 ]
933         ],
934         "notify" => [
935                 "comment" => "notifications",
936                 "fields" => [
937                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
938                         "type" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
939                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
940                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
941                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
942                         "date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
943                         "msg" => ["type" => "mediumtext", "comment" => ""],
944                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
945                         "link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
946                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id"],
947                         "parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
948                         "uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the related post"],
949                         "parent-uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
950                         "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
951                         "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""],
952                         "otype" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => ""],
953                         "name_cache" => ["type" => "tinytext", "comment" => "Cached bbcode parsing of name"],
954                         "msg_cache" => ["type" => "mediumtext", "comment" => "Cached bbcode parsing of msg"]
955                 ],
956                 "indexes" => [
957                         "PRIMARY" => ["id"],
958                         "seen_uid_date" => ["seen", "uid", "date"],
959                         "uid_date" => ["uid", "date"],
960                         "uid_type_link" => ["uid", "type", "link(190)"],
961                 ]
962         ],
963         "notify-threads" => [
964                 "comment" => "",
965                 "fields" => [
966                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
967                         "notify-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["notify" => "id"], "comment" => ""],
968                         "master-parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
969                         "master-parent-uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
970                         "parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
971                         "receiver-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"],
972                                 "comment" => "User id"],
973                 ],
974                 "indexes" => [
975                         "PRIMARY" => ["id"],
976                         "master-parent-uri-id" => ["master-parent-uri-id"],
977                 ]
978         ],
979         "oembed" => [
980                 "comment" => "cache for OEmbed queries",
981                 "fields" => [
982                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
983                         "maxwidth" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "comment" => "Maximum width passed to Oembed"],
984                         "content" => ["type" => "mediumtext", "comment" => "OEmbed data of the page"],
985                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
986                 ],
987                 "indexes" => [
988                         "PRIMARY" => ["url", "maxwidth"],
989                         "created" => ["created"],
990                 ]
991         ],
992         "openwebauth-token" => [
993                 "comment" => "Store OpenWebAuth token to verify contacts",
994                 "fields" => [
995                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
996                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
997                         "type" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Verify type"],
998                         "token" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A generated token"],
999                         "meta" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1000                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1001                 ],
1002                 "indexes" => [
1003                         "PRIMARY" => ["id"],
1004                 ]
1005         ],
1006         "parsed_url" => [
1007                 "comment" => "cache for 'parse_url' queries",
1008                 "fields" => [
1009                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1010                         "guessing" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the 'guessing' mode active?"],
1011                         "oembed" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the data the result of oembed?"],
1012                         "content" => ["type" => "mediumtext", "comment" => "page data"],
1013                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1014                 ],
1015                 "indexes" => [
1016                         "PRIMARY" => ["url", "guessing", "oembed"],
1017                         "created" => ["created"],
1018                 ]
1019         ],
1020         "participation" => [
1021                 "comment" => "Storage for participation messages from Diaspora",
1022                 "fields" => [
1023                         "iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "relation" => ["item" => "id"], "comment" => ""],
1024                         "server" => ["type" => "varchar(60)", "not null" => "1", "primary" => "1", "comment" => ""],
1025                         "cid" => ["type" => "int unsigned", "not null" => "1", "relation" => ["contact" => "id"], "comment" => ""],
1026                         "fid" => ["type" => "int unsigned", "not null" => "1", "relation" => ["fcontact" => "id"], "comment" => ""],
1027                 ],
1028                 "indexes" => [
1029                         "PRIMARY" => ["iid", "server"],
1030                         "cid" => ["cid"],
1031                         "fid" => ["fid"]
1032                 ]
1033         ],
1034         "pconfig" => [
1035                 "comment" => "personal (per user) configuration storage",
1036                 "fields" => [
1037                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1038                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1039                         "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
1040                         "k" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => ""],
1041                         "v" => ["type" => "mediumtext", "comment" => ""],
1042                 ],
1043                 "indexes" => [
1044                         "PRIMARY" => ["id"],
1045                         "uid_cat_k" => ["UNIQUE", "uid", "cat", "k"],
1046                 ]
1047         ],
1048         "photo" => [
1049                 "comment" => "photo storage",
1050                 "fields" => [
1051                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1052                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1053                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id"],
1054                         "guid" => ["type" => "char(16)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this photo"],
1055                         "resource-id" => ["type" => "char(32)", "not null" => "1", "default" => "", "comment" => ""],
1056                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation date"],
1057                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edited date"],
1058                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1059                         "desc" => ["type" => "text", "comment" => ""],
1060                         "album" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "The name of the album to which the photo belongs"],
1061                         "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1062                         "type" => ["type" => "varchar(30)", "not null" => "1", "default" => "image/jpeg"],
1063                         "height" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1064                         "width" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1065                         "datasize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1066                         "data" => ["type" => "mediumblob", "not null" => "1", "comment" => ""],
1067                         "scale" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1068                         "profile" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1069                         "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
1070                         "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
1071                         "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
1072                         "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
1073                         "accessible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Make photo publicly accessible, ignoring permissions"],
1074                         "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
1075                         "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
1076                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
1077                 ],
1078                 "indexes" => [
1079                         "PRIMARY" => ["id"],
1080                         "contactid" => ["contact-id"],
1081                         "uid_contactid" => ["uid", "contact-id"],
1082                         "uid_profile" => ["uid", "profile"],
1083                         "uid_album_scale_created" => ["uid", "album(32)", "scale", "created"],
1084                         "uid_album_resource-id_created" => ["uid", "album(32)", "resource-id", "created"],
1085                         "resource-id" => ["resource-id"],
1086                 ]
1087         ],
1088         "poll" => [
1089                 "comment" => "Currently unused table for storing poll results",
1090                 "fields" => [
1091                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1092                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1093                         "q0" => ["type" => "text", "comment" => ""],
1094                         "q1" => ["type" => "text", "comment" => ""],
1095                         "q2" => ["type" => "text", "comment" => ""],
1096                         "q3" => ["type" => "text", "comment" => ""],
1097                         "q4" => ["type" => "text", "comment" => ""],
1098                         "q5" => ["type" => "text", "comment" => ""],
1099                         "q6" => ["type" => "text", "comment" => ""],
1100                         "q7" => ["type" => "text", "comment" => ""],
1101                         "q8" => ["type" => "text", "comment" => ""],
1102                         "q9" => ["type" => "text", "comment" => ""],
1103                 ],
1104                 "indexes" => [
1105                         "PRIMARY" => ["id"],
1106                         "uid" => ["uid"],
1107                 ]
1108         ],
1109         "poll_result" => [
1110                 "comment" => "data for polls - currently unused",
1111                 "fields" => [
1112                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1113                         "poll_id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["poll" => "id"]],
1114                         "choice" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1115                 ],
1116                 "indexes" => [
1117                         "PRIMARY" => ["id"],
1118                         "poll_id" => ["poll_id"],
1119                 ]
1120         ],
1121         "post-category" => [
1122                 "comment" => "post relation to categories",
1123                 "fields" => [
1124                         "uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1",  "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
1125                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
1126                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1127                         "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1128                 ],
1129                 "indexes" => [
1130                         "PRIMARY" => ["uri-id", "uid", "type", "tid"],
1131                         "uri-id" => ["tid"]
1132                 ]
1133         ],
1134         "post-delivery-data" => [
1135                 "comment" => "Delivery data for items",
1136                 "fields" => [
1137                         "uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
1138                         "postopts" => ["type" => "text", "comment" => "External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery"],
1139                         "inform" => ["type" => "mediumtext", "comment" => "Additional receivers of the linked item"],
1140                         "queue_count" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Initial number of delivery recipients, used as item.delivery_queue_count"],
1141                         "queue_done" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries, used as item.delivery_queue_done"],
1142                         "queue_failed" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of unsuccessful deliveries, used as item.delivery_queue_failed"],
1143                         "activitypub" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via ActivityPub"],
1144                         "dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via DFRN"],
1145                         "legacy_dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via legacy DFRN"],
1146                         "diaspora" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via Diaspora"],
1147                         "ostatus" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via OStatus"],
1148                 ],
1149                 "indexes" => [
1150                         "PRIMARY" => ["uri-id"],
1151                 ]
1152         ],
1153         "post-tag" => [
1154                 "comment" => "post relation to tags",
1155                 "fields" => [
1156                         "uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
1157                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1158                         "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1159                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Contact id of the mentioned public contact"],
1160                 ],
1161                 "indexes" => [
1162                         "PRIMARY" => ["uri-id", "type", "tid", "cid"],
1163                         "tid" => ["tid"],
1164                         "cid" => ["cid"]
1165                 ]
1166         ],
1167         "process" => [
1168                 "comment" => "Currently running system processes",
1169                 "fields" => [
1170                         "pid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "comment" => ""],
1171                         "command" => ["type" => "varbinary(32)", "not null" => "1", "default" => "", "comment" => ""],
1172                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1173                 ],
1174                 "indexes" => [
1175                         "PRIMARY" => ["pid"],
1176                         "command" => ["command"],
1177                 ]
1178         ],
1179         "profile" => [
1180                 "comment" => "user profiles data",
1181                 "fields" => [
1182                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1183                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1184                         "profile-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1185                         "is-default" => ["type" => "boolean", "comment" => "Deprecated"],
1186                         "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide friend list from viewers of this profile"],
1187                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1188                         "pdesc" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1189                         "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => "Day of birth"],
1190                         "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1191                         "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1192                         "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1193                         "postal-code" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1194                         "country-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1195                         "hometown" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1196                         "gender" => ["type" => "varchar(32)", "comment" => "Deprecated"],
1197                         "marital" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1198                         "with" => ["type" => "text", "comment" => "Deprecated"],
1199                         "howlong" => ["type" => "datetime", "comment" => "Deprecated"],
1200                         "sexual" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1201                         "politic" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1202                         "religion" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1203                         "pub_keywords" => ["type" => "text", "comment" => ""],
1204                         "prv_keywords" => ["type" => "text", "comment" => ""],
1205                         "likes" => ["type" => "text", "comment" => "Deprecated"],
1206                         "dislikes" => ["type" => "text", "comment" => "Deprecated"],
1207                         "about" => ["type" => "text", "comment" => "Profile description"],
1208                         "summary" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1209                         "music" => ["type" => "text", "comment" => "Deprecated"],
1210                         "book" => ["type" => "text", "comment" => "Deprecated"],
1211                         "tv" => ["type" => "text", "comment" => "Deprecated"],
1212                         "film" => ["type" => "text", "comment" => "Deprecated"],
1213                         "interest" => ["type" => "text", "comment" => "Deprecated"],
1214                         "romance" => ["type" => "text", "comment" => "Deprecated"],
1215                         "work" => ["type" => "text", "comment" => "Deprecated"],
1216                         "education" => ["type" => "text", "comment" => "Deprecated"],
1217                         "contact" => ["type" => "text", "comment" => "Deprecated"],
1218                         "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1219                         "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1220                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1221                         "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1222                         "publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish default profile in local directory"],
1223                         "net-publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish profile in global directory"],
1224                 ],
1225                 "indexes" => [
1226                         "PRIMARY" => ["id"],
1227                         "uid_is-default" => ["uid", "is-default"],
1228                         "pub_keywords" => ["FULLTEXT", "pub_keywords"],
1229                 ]
1230         ],
1231         "profile_check" => [
1232                 "comment" => "DFRN remote auth use",
1233                 "fields" => [
1234                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1235                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1236                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id"],
1237                         "dfrn_id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1238                         "sec" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1239                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1240                 ],
1241                 "indexes" => [
1242                         "PRIMARY" => ["id"],
1243                 ]
1244         ],
1245         "profile_field" => [
1246                 "comment" => "Custom profile fields",
1247                 "fields" => [
1248                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1249                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner user id"],
1250                         "order" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "1", "comment" => "Field ordering per user"],
1251                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this profile field - 0 = public"],
1252                         "label" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Label of the field"],
1253                         "value" => ["type" => "text", "comment" => "Value of the field"],
1254                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
1255                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
1256                 ],
1257                 "indexes" => [
1258                         "PRIMARY" => ["id"],
1259                         "uid" => ["uid"],
1260                         "order" => ["order"],
1261                         "psid" => ["psid"],
1262                 ]
1263         ],
1264         "push_subscriber" => [
1265                 "comment" => "Used for OStatus: Contains feed subscribers",
1266                 "fields" => [
1267                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1268                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1269                         "callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1270                         "topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1271                         "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1272                         "push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1273                         "last_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last successful trial"],
1274                         "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1275                         "renewed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last subscription renewal"],
1276                         "secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1277                 ],
1278                 "indexes" => [
1279                         "PRIMARY" => ["id"],
1280                         "next_try" => ["next_try"],
1281                 ]
1282         ],
1283         "register" => [
1284                 "comment" => "registrations requiring admin approval",
1285                 "fields" => [
1286                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1287                         "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1288                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1289                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1290                         "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1291                         "language" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1292                         "note" => ["type" => "text", "comment" => ""],
1293                 ],
1294                 "indexes" => [
1295                         "PRIMARY" => ["id"],
1296                 ]
1297         ],
1298         "search" => [
1299                 "comment" => "",
1300                 "fields" => [
1301                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1302                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1303                         "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1304                 ],
1305                 "indexes" => [
1306                         "PRIMARY" => ["id"],
1307                         "uid" => ["uid"],
1308                 ]
1309         ],
1310         "session" => [
1311                 "comment" => "web session storage",
1312                 "fields" => [
1313                         "id" => ["type" => "bigint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1314                         "sid" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1315                         "data" => ["type" => "text", "comment" => ""],
1316                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1317                 ],
1318                 "indexes" => [
1319                         "PRIMARY" => ["id"],
1320                         "sid" => ["sid(64)"],
1321                         "expire" => ["expire"],
1322                 ]
1323         ],
1324         "storage" => [
1325                 "comment" => "Data stored by Database storage backend",
1326                 "fields" => [
1327                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented image data id"],
1328                         "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"]
1329                 ],
1330                 "indexes" => [
1331                         "PRIMARY" => ["id"]
1332                 ]
1333         ],
1334         "thread" => [
1335                 "comment" => "Thread related data",
1336                 "fields" => [
1337                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"],
1338                                 "comment" => "sequential ID"],
1339                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1340                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1341                         "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item owner"],
1342                         "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item author"],
1343                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1344                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1345                         "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1346                         "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1347                         "changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1348                         "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1349                         "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
1350                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1351                         "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1352                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1353                         "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1354                         "ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1355                         "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
1356                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1357                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1358                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1359                         "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1360                         "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1361                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
1362                         "bookmark" => ["type" => "boolean", "comment" => ""],
1363                 ],
1364                 "indexes" => [
1365                         "PRIMARY" => ["iid"],
1366                         "uid_network_commented" => ["uid", "network", "commented"],
1367                         "uid_network_received" => ["uid", "network", "received"],
1368                         "uid_contactid_commented" => ["uid", "contact-id", "commented"],
1369                         "uid_contactid_received" => ["uid", "contact-id", "received"],
1370                         "contactid" => ["contact-id"],
1371                         "ownerid" => ["owner-id"],
1372                         "authorid" => ["author-id"],
1373                         "uid_received" => ["uid", "received"],
1374                         "uid_commented" => ["uid", "commented"],
1375                         "uid_wall_received" => ["uid", "wall", "received"],
1376                         "private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
1377                 ]
1378         ],
1379         "tokens" => [
1380                 "comment" => "OAuth usage",
1381                 "fields" => [
1382                         "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
1383                         "secret" => ["type" => "text", "comment" => ""],
1384                         "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"]],
1385                         "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1386                         "scope" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
1387                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1388                 ],
1389                 "indexes" => [
1390                         "PRIMARY" => ["id"],
1391                         "client_id" => ["client_id"]
1392                 ]
1393         ],
1394         "user" => [
1395                 "comment" => "The local users",
1396                 "fields" => [
1397                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1398                         "parent-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"],
1399                                 "comment" => "The parent user that has full control about this user"],
1400                         "guid" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this user"],
1401                         "username" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this user is known by"],
1402                         "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "encrypted password"],
1403                         "legacy_password" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the password hash double-hashed?"],
1404                         "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "nick- and user name"],
1405                         "email" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "the users email address"],
1406                         "openid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1407                         "timezone" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => "PHP-legal timezone"],
1408                         "language" => ["type" => "varchar(32)", "not null" => "1", "default" => "en", "comment" => "default language"],
1409                         "register_date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of registration"],
1410                         "login_date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of last login"],
1411                         "default-location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Default for item.location"],
1412                         "allow_location" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 allows to display the location"],
1413                         "theme" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "user theme preference"],
1414                         "pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
1415                         "prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
1416                         "spubkey" => ["type" => "text", "comment" => ""],
1417                         "sprvkey" => ["type" => "text", "comment" => ""],
1418                         "verified" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "user is verified through email"],
1419                         "blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 for user is blocked"],
1420                         "blockwall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to post to the profile page of the user"],
1421                         "hidewall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide profile details from unkown viewers"],
1422                         "blocktags" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to tag the post of this user"],
1423                         "unkmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Permit unknown people to send private mails to this user"],
1424                         "cntunkmail" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
1425                         "notify-flags" => ["type" => "smallint unsigned", "not null" => "1", "default" => "65535", "comment" => "email notification options"],
1426                         "page-flags" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "page/profile type"],
1427                         "account-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1428                         "prvnets" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1429                         "pwdreset" => ["type" => "varchar(255)", "comment" => "Password reset request token"],
1430                         "pwdreset_time" => ["type" => "datetime", "comment" => "Timestamp of the last password reset request"],
1431                         "maxreq" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
1432                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1433                         "account_removed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if 1 the account is removed"],
1434                         "account_expired" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1435                         "account_expires_on" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp when account expires and will be deleted"],
1436                         "expire_notification_sent" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "timestamp of last warning of account expiration"],
1437                         "def_gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1438                         "allow_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
1439                         "allow_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
1440                         "deny_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
1441                         "deny_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
1442                         "openidserver" => ["type" => "text", "comment" => ""],
1443                 ],
1444                 "indexes" => [
1445                         "PRIMARY" => ["uid"],
1446                         "nickname" => ["nickname(32)"],
1447                 ]
1448         ],
1449         "userd" => [
1450                 "comment" => "Deleted usernames",
1451                 "fields" => [
1452                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1453                         "username" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
1454                 ],
1455                 "indexes" => [
1456                         "PRIMARY" => ["id"],
1457                         "username" => ["username(32)"],
1458                 ]
1459         ],
1460         "user-contact" => [
1461                 "comment" => "User specific public contact data",
1462                 "fields" => [
1463                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["contact" => "id"], "comment" => "Contact id of the linked public contact"],
1464                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
1465                         "blocked" => ["type" => "boolean", "comment" => "Contact is completely blocked for this user"],
1466                         "ignored" => ["type" => "boolean", "comment" => "Posts from this contact are ignored"],
1467                         "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"]
1468                 ],
1469                 "indexes" => [
1470                         "PRIMARY" => ["uid", "cid"]
1471                 ]
1472         ],
1473         "user-item" => [
1474                 "comment" => "User specific item data",
1475                 "fields" => [
1476                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
1477                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
1478                         "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
1479                         "ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
1480                         "pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"],
1481                         "notification-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1482                 ],
1483                 "indexes" => [
1484                         "PRIMARY" => ["uid", "iid"],
1485                         "uid_pinned" => ["uid", "pinned"],
1486                         "iid_uid" => ["iid", "uid"]
1487                 ]
1488         ],
1489         "verb" => [
1490                 "comment" => "Activity Verbs",
1491                 "fields" => [
1492                         "id" => ["type" => "smallint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
1493                         "name" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""]
1494                 ],
1495                 "indexes" => [
1496                         "PRIMARY" => ["id"]
1497                 ]
1498         ],
1499         "worker-ipc" => [
1500                 "comment" => "Inter process communication between the frontend and the worker",
1501                 "fields" => [
1502                         "key" => ["type" => "int", "not null" => "1", "primary" => "1", "comment" => ""],
1503                         "jobs" => ["type" => "boolean", "comment" => "Flag for outstanding jobs"],
1504                 ],
1505                 "indexes" => [
1506                         "PRIMARY" => ["key"],
1507                 ],
1508                 "engine" => "MEMORY",
1509         ],
1510         "workerqueue" => [
1511                 "comment" => "Background tasks queue entries",
1512                 "fields" => [
1513                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
1514                         "parameter" => ["type" => "mediumtext", "comment" => "Task command"],
1515                         "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"],
1516                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"],
1517                         "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
1518                         "executed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Execution date"],
1519                         "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1520                         "retrial" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1521                         "done" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marked 1 when the task was done - will be deleted later"],
1522                 ],
1523                 "indexes" => [
1524                         "PRIMARY" => ["id"],
1525                         "done_parameter" => ["done", "parameter(64)"],
1526                         "done_executed" => ["done", "executed"],
1527                         "done_priority_created" => ["done", "priority", "created"],
1528                         "done_priority_next_try" => ["done", "priority", "next_try"],
1529                         "done_pid_next_try" => ["done", "pid", "next_try"],
1530                         "done_pid_priority_created" => ["done", "pid", "priority", "created"]
1531                 ]
1532         ],
1533 ];