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