]> git.mxchange.org Git - friendica.git/blob - static/dbstructure.config.php
Merge pull request #9500 from MrPetovan/bug/9326-owner-view-blocked
[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', 1373);
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                         // Deprecated fields. Will be removed in upcoming versions
751                         "attach" => ["type" => "mediumtext", "comment" => "Deprecated"],
752                         "allow_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
753                         "allow_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
754                         "deny_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
755                         "deny_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
756                         "postopts" => ["type" => "text", "comment" => "Deprecated"],
757                         "inform" => ["type" => "mediumtext", "comment" => "Deprecated"],
758                         "type" => ["type" => "varchar(20)", "comment" => "Deprecated"],
759                         "bookmark" => ["type" => "boolean", "comment" => "Deprecated"],
760                         "file" => ["type" => "mediumtext", "comment" => "Deprecated"],
761                         "location" => ["type" => "varchar(255)", "comment" => "Deprecated"],
762                         "coord" => ["type" => "varchar(255)", "comment" => "Deprecated"],
763                         "tag" => ["type" => "mediumtext", "comment" => "Deprecated"],
764                         "plink" => ["type" => "varchar(255)", "comment" => "Deprecated"],
765                         "title" => ["type" => "varchar(255)", "comment" => "Deprecated"],
766                         "content-warning" => ["type" => "varchar(255)", "comment" => "Deprecated"],
767                         "body" => ["type" => "mediumtext", "comment" => "Deprecated"],
768                         "app" => ["type" => "varchar(255)", "comment" => "Deprecated"],
769                         "verb" => ["type" => "varchar(100)", "comment" => "Deprecated"],
770                         "object-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
771                         "object" => ["type" => "text", "comment" => "Deprecated"],
772                         "target-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
773                         "target" => ["type" => "text", "comment" => "Deprecated"],
774                         "author-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
775                         "author-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
776                         "author-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
777                         "owner-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
778                         "owner-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
779                         "owner-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
780                         "rendered-hash" => ["type" => "varchar(32)", "comment" => "Deprecated"],
781                         "rendered-html" => ["type" => "mediumtext", "comment" => "Deprecated"],
782                 ],
783                 "indexes" => [
784                         "PRIMARY" => ["id"],
785                         "guid" => ["guid(191)"],
786                         "uri" => ["uri(191)"],
787                         "parent" => ["parent"],
788                         "parent-uri" => ["parent-uri(191)"],
789                         "extid" => ["extid(191)"],
790                         "uid_id" => ["uid", "id"],
791                         "uid_contactid_id" => ["uid", "contact-id", "id"],
792                         "uid_received" => ["uid", "received"],
793                         "uid_commented" => ["uid", "commented"],
794                         "uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
795                         "uid_network_received" => ["uid", "network", "received"],
796                         "uid_network_commented" => ["uid", "network", "commented"],
797                         "uid_thrparent" => ["uid", "thr-parent(190)"],
798                         "uid_parenturi" => ["uid", "parent-uri(190)"],
799                         "uid_contactid_received" => ["uid", "contact-id", "received"],
800                         "authorid_received" => ["author-id", "received"],
801                         "ownerid" => ["owner-id"],
802                         "contact-id" => ["contact-id"],
803                         "uid_uri" => ["uid", "uri(190)"],
804                         "resource-id" => ["resource-id"],
805                         "deleted_changed" => ["deleted", "changed"],
806                         "uid_wall_changed" => ["uid", "wall", "changed"],
807                         "uid_unseen_wall" => ["uid", "unseen", "wall"],
808                         "mention_uid_id" => ["mention", "uid", "id"],
809                         "uid_eventid" => ["uid", "event-id"],
810                         "icid" => ["icid"],
811                         "iaid" => ["iaid"],
812                         "psid_wall" => ["psid", "wall"],
813                         "uri-id" => ["uri-id"],
814                         "parent-uri-id" => ["parent-uri-id"],
815                         "thr-parent-id" => ["thr-parent-id"],
816                         "causer-id" => ["causer-id"],
817                 ]
818         ],
819         "item-activity" => [
820                 "comment" => "Activities for items",
821                 "fields" => [
822                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
823                         "uri" => ["type" => "varchar(255)", "comment" => ""],
824                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
825                         "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
826                         "activity" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""]
827                 ],
828                 "indexes" => [
829                         "PRIMARY" => ["id"],
830                         "uri-hash" => ["UNIQUE", "uri-hash"],
831                         "uri" => ["uri(191)"],
832                         "uri-id" => ["uri-id"]
833                 ]
834         ],
835         "item-content" => [
836                 "comment" => "Content for all posts",
837                 "fields" => [
838                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
839                         "uri" => ["type" => "varchar(255)", "comment" => ""],
840                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
841                         "uri-plink-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
842                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
843                         "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
844                         "body" => ["type" => "mediumtext", "comment" => "item body content"],
845                         "raw-body" => ["type" => "mediumtext", "comment" => "Body without embedded media links"],
846                         "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
847                         "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
848                         "language" => ["type" => "text", "comment" => "Language information about this post"],
849                         "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
850                         "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
851                         "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
852                         "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
853                         "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
854                         "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
855                         "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
856                         "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
857                         "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams verb"]
858                 ],
859                 "indexes" => [
860                         "PRIMARY" => ["id"],
861                         "uri-plink-hash" => ["UNIQUE", "uri-plink-hash"],
862                         "title-content-warning-body" => ["FULLTEXT", "title", "content-warning", "body"],
863                         "uri" => ["uri(191)"],
864                         "plink" => ["plink(191)"],
865                         "uri-id" => ["uri-id"]
866                 ]
867         ],
868         "locks" => [
869                 "comment" => "",
870                 "fields" => [
871                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
872                         "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
873                         "locked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
874                         "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process ID"],
875                         "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
876                 ],
877                 "indexes" => [
878                         "PRIMARY" => ["id"],
879                         "name_expires" => ["name", "expires"]
880                 ]
881         ],
882         "mail" => [
883                 "comment" => "private messages",
884                 "fields" => [
885                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
886                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
887                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this private message"],
888                         "from-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "name of the sender"],
889                         "from-photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "contact photo link of the sender"],
890                         "from-url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "profile linke of the sender"],
891                         "contact-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => ["contact" => "id"], "comment" => "contact.id"],
892                         "convid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["conv" => "id"], "comment" => "conv.id"],
893                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
894                         "body" => ["type" => "mediumtext", "comment" => ""],
895                         "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if message visited it is 1"],
896                         "reply" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
897                         "replied" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
898                         "unknown" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if sender not in the contact table this is 1"],
899                         "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
900                         "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
901                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time of the private message"],
902                 ],
903                 "indexes" => [
904                         "PRIMARY" => ["id"],
905                         "uid_seen" => ["uid", "seen"],
906                         "convid" => ["convid"],
907                         "uri" => ["uri(64)"],
908                         "parent-uri" => ["parent-uri(64)"],
909                         "contactid" => ["contact-id(32)"],
910                 ]
911         ],
912         "mailacct" => [
913                 "comment" => "Mail account data for fetching mails",
914                 "fields" => [
915                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
916                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
917                         "server" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
918                         "port" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
919                         "ssltype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
920                         "mailbox" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
921                         "user" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
922                         "pass" => ["type" => "text", "comment" => ""],
923                         "reply_to" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
924                         "action" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
925                         "movetofolder" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
926                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
927                         "last_check" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
928                 ],
929                 "indexes" => [
930                         "PRIMARY" => ["id"],
931                         "uid" => ["uid"],
932                 ]
933         ],
934         "manage" => [
935                 "comment" => "table of accounts that can manage each other",
936                 "fields" => [
937                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
938                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
939                         "mid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
940                 ],
941                 "indexes" => [
942                         "PRIMARY" => ["id"],
943                         "uid_mid" => ["UNIQUE", "uid", "mid"],
944                         "mid" => ["mid"],
945                 ]
946         ],
947         "notify" => [
948                 "comment" => "notifications",
949                 "fields" => [
950                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
951                         "type" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
952                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
953                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
954                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
955                         "date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
956                         "msg" => ["type" => "mediumtext", "comment" => ""],
957                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
958                         "link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
959                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id"],
960                         "parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
961                         "uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the related post"],
962                         "parent-uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
963                         "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
964                         "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""],
965                         "otype" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => ""],
966                         "name_cache" => ["type" => "tinytext", "comment" => "Cached bbcode parsing of name"],
967                         "msg_cache" => ["type" => "mediumtext", "comment" => "Cached bbcode parsing of msg"]
968                 ],
969                 "indexes" => [
970                         "PRIMARY" => ["id"],
971                         "seen_uid_date" => ["seen", "uid", "date"],
972                         "uid_date" => ["uid", "date"],
973                         "uid_type_link" => ["uid", "type", "link(190)"],
974                 ]
975         ],
976         "notify-threads" => [
977                 "comment" => "",
978                 "fields" => [
979                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
980                         "notify-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["notify" => "id"], "comment" => ""],
981                         "master-parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
982                         "master-parent-uri-id" => ["type" => "int unsigned", "relation" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
983                         "parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
984                         "receiver-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"],
985                                 "comment" => "User id"],
986                 ],
987                 "indexes" => [
988                         "PRIMARY" => ["id"],
989                         "master-parent-uri-id" => ["master-parent-uri-id"],
990                         "receiver-uid" => ["receiver-uid"],
991                         "notify-id" => ["notify-id"],
992                 ]
993         ],
994         "oembed" => [
995                 "comment" => "cache for OEmbed queries",
996                 "fields" => [
997                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
998                         "maxwidth" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "comment" => "Maximum width passed to Oembed"],
999                         "content" => ["type" => "mediumtext", "comment" => "OEmbed data of the page"],
1000                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1001                 ],
1002                 "indexes" => [
1003                         "PRIMARY" => ["url", "maxwidth"],
1004                         "created" => ["created"],
1005                 ]
1006         ],
1007         "openwebauth-token" => [
1008                 "comment" => "Store OpenWebAuth token to verify contacts",
1009                 "fields" => [
1010                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1011                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id - currently unused"],
1012                         "type" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Verify type"],
1013                         "token" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A generated token"],
1014                         "meta" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1015                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1016                 ],
1017                 "indexes" => [
1018                         "PRIMARY" => ["id"],
1019                         "uid" => ["uid"],
1020                 ]
1021         ],
1022         "parsed_url" => [
1023                 "comment" => "cache for 'parse_url' queries",
1024                 "fields" => [
1025                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1026                         "guessing" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the 'guessing' mode active?"],
1027                         "oembed" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the data the result of oembed?"],
1028                         "content" => ["type" => "mediumtext", "comment" => "page data"],
1029                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1030                 ],
1031                 "indexes" => [
1032                         "PRIMARY" => ["url", "guessing", "oembed"],
1033                         "created" => ["created"],
1034                 ]
1035         ],
1036         "participation" => [
1037                 "comment" => "Storage for participation messages from Diaspora",
1038                 "fields" => [
1039                         "iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item" => "id"], "comment" => ""],
1040                         "server" => ["type" => "varchar(60)", "not null" => "1", "primary" => "1", "comment" => ""],
1041                         "cid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["contact" => "id"], "comment" => ""],
1042                         "fid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["fcontact" => "id"], "comment" => ""],
1043                 ],
1044                 "indexes" => [
1045                         "PRIMARY" => ["iid", "server"],
1046                         "cid" => ["cid"],
1047                         "fid" => ["fid"]
1048                 ]
1049         ],
1050         "pconfig" => [
1051                 "comment" => "personal (per user) configuration storage",
1052                 "fields" => [
1053                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1054                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1055                         "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
1056                         "k" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => ""],
1057                         "v" => ["type" => "mediumtext", "comment" => ""],
1058                 ],
1059                 "indexes" => [
1060                         "PRIMARY" => ["id"],
1061                         "uid_cat_k" => ["UNIQUE", "uid", "cat", "k"],
1062                 ]
1063         ],
1064         "photo" => [
1065                 "comment" => "photo storage",
1066                 "fields" => [
1067                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1068                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1069                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "contact.id"],
1070                         "guid" => ["type" => "char(16)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this photo"],
1071                         "resource-id" => ["type" => "char(32)", "not null" => "1", "default" => "", "comment" => ""],
1072                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation date"],
1073                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edited date"],
1074                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1075                         "desc" => ["type" => "text", "comment" => ""],
1076                         "album" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "The name of the album to which the photo belongs"],
1077                         "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1078                         "type" => ["type" => "varchar(30)", "not null" => "1", "default" => "image/jpeg"],
1079                         "height" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1080                         "width" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1081                         "datasize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1082                         "data" => ["type" => "mediumblob", "not null" => "1", "comment" => ""],
1083                         "scale" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1084                         "profile" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1085                         "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
1086                         "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
1087                         "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
1088                         "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
1089                         "accessible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Make photo publicly accessible, ignoring permissions"],
1090                         "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
1091                         "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
1092                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
1093                 ],
1094                 "indexes" => [
1095                         "PRIMARY" => ["id"],
1096                         "contactid" => ["contact-id"],
1097                         "uid_contactid" => ["uid", "contact-id"],
1098                         "uid_profile" => ["uid", "profile"],
1099                         "uid_album_scale_created" => ["uid", "album(32)", "scale", "created"],
1100                         "uid_album_resource-id_created" => ["uid", "album(32)", "resource-id", "created"],
1101                         "resource-id" => ["resource-id"],
1102                 ]
1103         ],
1104         "post-category" => [
1105                 "comment" => "post relation to categories",
1106                 "fields" => [
1107                         "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"],
1108                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
1109                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1110                         "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1111                 ],
1112                 "indexes" => [
1113                         "PRIMARY" => ["uri-id", "uid", "type", "tid"],
1114                         "uri-id" => ["tid"]
1115                 ]
1116         ],
1117         "post-delivery-data" => [
1118                 "comment" => "Delivery data for items",
1119                 "fields" => [
1120                         "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"],
1121                         "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"],
1122                         "inform" => ["type" => "mediumtext", "comment" => "Additional receivers of the linked item"],
1123                         "queue_count" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Initial number of delivery recipients, used as item.delivery_queue_count"],
1124                         "queue_done" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries, used as item.delivery_queue_done"],
1125                         "queue_failed" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of unsuccessful deliveries, used as item.delivery_queue_failed"],
1126                         "activitypub" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via ActivityPub"],
1127                         "dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via DFRN"],
1128                         "legacy_dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via legacy DFRN"],
1129                         "diaspora" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via Diaspora"],
1130                         "ostatus" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via OStatus"],
1131                 ],
1132                 "indexes" => [
1133                         "PRIMARY" => ["uri-id"],
1134                 ]
1135         ],
1136         "post-media" => [
1137                 "comment" => "Attached media",
1138                 "fields" => [
1139                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1140                         "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"],
1141                         "url" => ["type" => "varbinary(511)", "not null" => "1", "comment" => "Media URL"],
1142                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Media type"],
1143                         "mimetype" => ["type" => "varchar(60)", "comment" => ""],
1144                         "height" => ["type" => "smallint unsigned", "comment" => "Height of the media"],
1145                         "width" => ["type" => "smallint unsigned", "comment" => "Width of the media"],
1146                         "size" => ["type" => "int unsigned", "comment" => "Media size"],
1147                         "preview" => ["type" => "varbinary(255)", "comment" => "Preview URL"],
1148                         "preview-height" => ["type" => "smallint unsigned", "comment" => "Height of the preview picture"],
1149                         "preview-width" => ["type" => "smallint unsigned", "comment" => "Width of the preview picture"],
1150                         "description" => ["type" => "text", "comment" => ""],
1151                 ],
1152                 "indexes" => [
1153                         "PRIMARY" => ["id"],
1154                         "uri-id-url" => ["UNIQUE", "uri-id", "url"],
1155                 ]
1156         ],
1157         "post-tag" => [
1158                 "comment" => "post relation to tags",
1159                 "fields" => [
1160                         "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"],
1161                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1162                         "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1163                         "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"],
1164                 ],
1165                 "indexes" => [
1166                         "PRIMARY" => ["uri-id", "type", "tid", "cid"],
1167                         "tid" => ["tid"],
1168                         "cid" => ["cid"]
1169                 ]
1170         ],
1171         "process" => [
1172                 "comment" => "Currently running system processes",
1173                 "fields" => [
1174                         "pid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "comment" => ""],
1175                         "command" => ["type" => "varbinary(32)", "not null" => "1", "default" => "", "comment" => ""],
1176                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1177                 ],
1178                 "indexes" => [
1179                         "PRIMARY" => ["pid"],
1180                         "command" => ["command"],
1181                 ]
1182         ],
1183         "profile" => [
1184                 "comment" => "user profiles data",
1185                 "fields" => [
1186                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1187                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
1188                         "profile-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1189                         "is-default" => ["type" => "boolean", "comment" => "Deprecated"],
1190                         "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide friend list from viewers of this profile"],
1191                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1192                         "pdesc" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1193                         "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => "Day of birth"],
1194                         "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1195                         "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1196                         "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1197                         "postal-code" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1198                         "country-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1199                         "hometown" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1200                         "gender" => ["type" => "varchar(32)", "comment" => "Deprecated"],
1201                         "marital" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1202                         "with" => ["type" => "text", "comment" => "Deprecated"],
1203                         "howlong" => ["type" => "datetime", "comment" => "Deprecated"],
1204                         "sexual" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1205                         "politic" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1206                         "religion" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1207                         "pub_keywords" => ["type" => "text", "comment" => ""],
1208                         "prv_keywords" => ["type" => "text", "comment" => ""],
1209                         "likes" => ["type" => "text", "comment" => "Deprecated"],
1210                         "dislikes" => ["type" => "text", "comment" => "Deprecated"],
1211                         "about" => ["type" => "text", "comment" => "Profile description"],
1212                         "summary" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1213                         "music" => ["type" => "text", "comment" => "Deprecated"],
1214                         "book" => ["type" => "text", "comment" => "Deprecated"],
1215                         "tv" => ["type" => "text", "comment" => "Deprecated"],
1216                         "film" => ["type" => "text", "comment" => "Deprecated"],
1217                         "interest" => ["type" => "text", "comment" => "Deprecated"],
1218                         "romance" => ["type" => "text", "comment" => "Deprecated"],
1219                         "work" => ["type" => "text", "comment" => "Deprecated"],
1220                         "education" => ["type" => "text", "comment" => "Deprecated"],
1221                         "contact" => ["type" => "text", "comment" => "Deprecated"],
1222                         "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1223                         "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1224                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1225                         "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1226                         "publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish default profile in local directory"],
1227                         "net-publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish profile in global directory"],
1228                 ],
1229                 "indexes" => [
1230                         "PRIMARY" => ["id"],
1231                         "uid_is-default" => ["uid", "is-default"],
1232                         "pub_keywords" => ["FULLTEXT", "pub_keywords"],
1233                 ]
1234         ],
1235         "profile_check" => [
1236                 "comment" => "DFRN remote auth use",
1237                 "fields" => [
1238                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1239                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1240                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
1241                         "dfrn_id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1242                         "sec" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1243                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1244                 ],
1245                 "indexes" => [
1246                         "PRIMARY" => ["id"],
1247                         "uid" => ["uid"],
1248                         "cid" => ["cid"],
1249                 ]
1250         ],
1251         "profile_field" => [
1252                 "comment" => "Custom profile fields",
1253                 "fields" => [
1254                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1255                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner user id"],
1256                         "order" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "1", "comment" => "Field ordering per user"],
1257                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this profile field - 0 = public"],
1258                         "label" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Label of the field"],
1259                         "value" => ["type" => "text", "comment" => "Value of the field"],
1260                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
1261                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
1262                 ],
1263                 "indexes" => [
1264                         "PRIMARY" => ["id"],
1265                         "uid" => ["uid"],
1266                         "order" => ["order"],
1267                         "psid" => ["psid"],
1268                 ]
1269         ],
1270         "push_subscriber" => [
1271                 "comment" => "Used for OStatus: Contains feed subscribers",
1272                 "fields" => [
1273                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1274                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1275                         "callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1276                         "topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1277                         "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1278                         "push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1279                         "last_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last successful trial"],
1280                         "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1281                         "renewed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last subscription renewal"],
1282                         "secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1283                 ],
1284                 "indexes" => [
1285                         "PRIMARY" => ["id"],
1286                         "next_try" => ["next_try"],
1287                         "uid" => ["uid"]
1288                 ]
1289         ],
1290         "register" => [
1291                 "comment" => "registrations requiring admin approval",
1292                 "fields" => [
1293                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1294                         "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1295                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1296                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1297                         "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1298                         "language" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1299                         "note" => ["type" => "text", "comment" => ""],
1300                 ],
1301                 "indexes" => [
1302                         "PRIMARY" => ["id"],
1303                         "uid" => ["uid"],
1304                 ]
1305         ],
1306         "search" => [
1307                 "comment" => "",
1308                 "fields" => [
1309                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1310                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1311                         "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1312                 ],
1313                 "indexes" => [
1314                         "PRIMARY" => ["id"],
1315                         "uid" => ["uid"],
1316                 ]
1317         ],
1318         "session" => [
1319                 "comment" => "web session storage",
1320                 "fields" => [
1321                         "id" => ["type" => "bigint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1322                         "sid" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1323                         "data" => ["type" => "text", "comment" => ""],
1324                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1325                 ],
1326                 "indexes" => [
1327                         "PRIMARY" => ["id"],
1328                         "sid" => ["sid(64)"],
1329                         "expire" => ["expire"],
1330                 ]
1331         ],
1332         "storage" => [
1333                 "comment" => "Data stored by Database storage backend",
1334                 "fields" => [
1335                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented image data id"],
1336                         "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"]
1337                 ],
1338                 "indexes" => [
1339                         "PRIMARY" => ["id"]
1340                 ]
1341         ],
1342         "thread" => [
1343                 "comment" => "Thread related data",
1344                 "fields" => [
1345                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"],
1346                                 "comment" => "sequential ID"],
1347                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
1348                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1349                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1350                         "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item owner"],
1351                         "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item author"],
1352                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1353                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1354                         "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1355                         "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1356                         "changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1357                         "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1358                         "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
1359                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1360                         "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1361                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1362                         "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1363                         "ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1364                         "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
1365                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1366                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1367                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1368                         "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1369                         "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1370                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
1371                         "bookmark" => ["type" => "boolean", "comment" => ""],
1372                 ],
1373                 "indexes" => [
1374                         "PRIMARY" => ["iid"],
1375                         "uid_network_commented" => ["uid", "network", "commented"],
1376                         "uid_network_received" => ["uid", "network", "received"],
1377                         "uid_contactid_commented" => ["uid", "contact-id", "commented"],
1378                         "uid_contactid_received" => ["uid", "contact-id", "received"],
1379                         "contactid" => ["contact-id"],
1380                         "ownerid" => ["owner-id"],
1381                         "authorid" => ["author-id"],
1382                         "uid_received" => ["uid", "received"],
1383                         "uid_commented" => ["uid", "commented"],
1384                         "uid_wall_received" => ["uid", "wall", "received"],
1385                         "private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
1386                         "uri-id" => ["uri-id"],
1387                 ]
1388         ],
1389         "tokens" => [
1390                 "comment" => "OAuth usage",
1391                 "fields" => [
1392                         "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
1393                         "secret" => ["type" => "text", "comment" => ""],
1394                         "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"]],
1395                         "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1396                         "scope" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
1397                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1398                 ],
1399                 "indexes" => [
1400                         "PRIMARY" => ["id"],
1401                         "client_id" => ["client_id"],
1402                         "uid" => ["uid"]
1403                 ]
1404         ],
1405         "userd" => [
1406                 "comment" => "Deleted usernames",
1407                 "fields" => [
1408                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1409                         "username" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
1410                 ],
1411                 "indexes" => [
1412                         "PRIMARY" => ["id"],
1413                         "username" => ["username(32)"],
1414                 ]
1415         ],
1416         "user-contact" => [
1417                 "comment" => "User specific public contact data",
1418                 "fields" => [
1419                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["contact" => "id"], "comment" => "Contact id of the linked public contact"],
1420                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1421                         "blocked" => ["type" => "boolean", "comment" => "Contact is completely blocked for this user"],
1422                         "ignored" => ["type" => "boolean", "comment" => "Posts from this contact are ignored"],
1423                         "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"]
1424                 ],
1425                 "indexes" => [
1426                         "PRIMARY" => ["uid", "cid"],
1427                         "cid" => ["cid"],
1428                 ]
1429         ],
1430         "user-item" => [
1431                 "comment" => "User specific item data",
1432                 "fields" => [
1433                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"], "comment" => "Item id"],
1434                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1435                         "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
1436                         "ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
1437                         "pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"],
1438                         "notification-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1439                 ],
1440                 "indexes" => [
1441                         "PRIMARY" => ["uid", "iid"],
1442                         "uid_pinned" => ["uid", "pinned"],
1443                         "iid_uid" => ["iid", "uid"]
1444                 ]
1445         ],
1446         "verb" => [
1447                 "comment" => "Activity Verbs",
1448                 "fields" => [
1449                         "id" => ["type" => "smallint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
1450                         "name" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""]
1451                 ],
1452                 "indexes" => [
1453                         "PRIMARY" => ["id"]
1454                 ]
1455         ],
1456         "worker-ipc" => [
1457                 "comment" => "Inter process communication between the frontend and the worker",
1458                 "fields" => [
1459                         "key" => ["type" => "int", "not null" => "1", "primary" => "1", "comment" => ""],
1460                         "jobs" => ["type" => "boolean", "comment" => "Flag for outstanding jobs"],
1461                 ],
1462                 "indexes" => [
1463                         "PRIMARY" => ["key"],
1464                 ],
1465                 "engine" => "MEMORY",
1466         ],
1467         "workerqueue" => [
1468                 "comment" => "Background tasks queue entries",
1469                 "fields" => [
1470                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
1471                         "parameter" => ["type" => "mediumtext", "comment" => "Task command"],
1472                         "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"],
1473                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"],
1474                         "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
1475                         "executed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Execution date"],
1476                         "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1477                         "retrial" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1478                         "done" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marked 1 when the task was done - will be deleted later"],
1479                 ],
1480                 "indexes" => [
1481                         "PRIMARY" => ["id"],
1482                         "done_parameter" => ["done", "parameter(64)"],
1483                         "done_executed" => ["done", "executed"],
1484                         "done_priority_retrial_created" => ["done", "priority", "retrial", "created"],
1485                         "done_priority_next_try" => ["done", "priority", "next_try"],
1486                         "done_pid_next_try" => ["done", "pid", "next_try"],
1487                         "done_pid_retrial" => ["done", "pid", "retrial"],
1488                         "done_pid_priority_created" => ["done", "pid", "priority", "created"]
1489                 ]
1490         ],
1491 ];