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