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