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