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