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