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