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