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