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