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