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