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