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