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