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