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