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