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