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