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