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