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