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