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