]> git.mxchange.org Git - friendica.git/blob - static/dbstructure.config.php
e413822d76d3041a1a8301f9673c9aeb5c83f05e
[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', 1382);
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         "delayed-post" => [
533                 "comment" => "Posts that are about to be distributed at a later time",
534                 "fields" => [
535                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
536                         "uri" => ["type" => "varchar(255)", "comment" => "URI of the post that will be distributed later"],
537                         "uid" => ["type" => "mediumint unsigned", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
538                         "delayed" => ["type" => "datetime", "comment" => "delay time"],
539                 ],
540                 "indexes" => [
541                         "PRIMARY" => ["id"],
542                         "uid_uri" => ["UNIQUE", "uid", "uri(190)"],
543                 ]
544         ],
545         "diaspora-interaction" => [
546                 "comment" => "Signed Diaspora Interaction",
547                 "fields" => [
548                         "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"],
549                         "interaction" => ["type" => "mediumtext", "comment" => "The Diaspora interaction"]
550                 ],
551                 "indexes" => [
552                         "PRIMARY" => ["uri-id"]
553                 ]
554         ],
555         "event" => [
556                 "comment" => "Events",
557                 "fields" => [
558                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
559                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
560                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
561                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact_id (ID of the contact in contact table)"],
562                         "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
563                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
564                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
565                         "start" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event start time"],
566                         "finish" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "event end time"],
567                         "summary" => ["type" => "text", "comment" => "short description or title of the event"],
568                         "desc" => ["type" => "text", "comment" => "event description"],
569                         "location" => ["type" => "text", "comment" => "event location"],
570                         "type" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => "event or birthday"],
571                         "nofinish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if event does have no end this is 1"],
572                         "adjust" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "adjust to timezone of the recipient (0 or 1)"],
573                         "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "0 or 1"],
574                         "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
575                         "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
576                         "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
577                         "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
578                 ],
579                 "indexes" => [
580                         "PRIMARY" => ["id"],
581                         "uid_start" => ["uid", "start"],
582                         "cid" => ["cid"],
583                 ]
584         ],
585         "fcontact" => [
586                 "comment" => "Diaspora compatible contacts - used in the Diaspora implementation",
587                 "fields" => [
588                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
589                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "unique id"],
590                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
591                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
592                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
593                         "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
594                         "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
595                         "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
596                         "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
597                         "notify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
598                         "poll" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
599                         "confirm" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
600                         "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
601                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
602                         "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
603                         "pubkey" => ["type" => "text", "comment" => ""],
604                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
605                 ],
606                 "indexes" => [
607                         "PRIMARY" => ["id"],
608                         "addr" => ["addr(32)"],
609                         "url" => ["UNIQUE", "url(190)"],
610                 ]
611         ],
612         "fsuggest" => [
613                 "comment" => "friend suggestion stuff",
614                 "fields" => [
615                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
616                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
617                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
618                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
619                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
620                         "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
621                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
622                         "note" => ["type" => "text", "comment" => ""],
623                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
624                 ],
625                 "indexes" => [
626                         "PRIMARY" => ["id"],
627                         "cid" => ["cid"],
628                         "uid" => ["uid"],
629                 ]
630         ],
631         "group" => [
632                 "comment" => "privacy groups, group info",
633                 "fields" => [
634                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
635                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
636                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the member list is not private"],
637                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the group has been deleted"],
638                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "human readable name of group"],
639                 ],
640                 "indexes" => [
641                         "PRIMARY" => ["id"],
642                         "uid" => ["uid"],
643                 ]
644         ],
645         "group_member" => [
646                 "comment" => "privacy groups, member info",
647                 "fields" => [
648                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
649                         "gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["group" => "id"], "comment" => "groups.id of the associated group"],
650                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id of the member assigned to the associated group"],
651                 ],
652                 "indexes" => [
653                         "PRIMARY" => ["id"],
654                         "contactid" => ["contact-id"],
655                         "gid_contactid" => ["UNIQUE", "gid", "contact-id"],
656                 ]
657         ],
658         "gserver-tag" => [
659                 "comment" => "Tags that the server has subscribed",
660                 "fields" => [
661                         "gserver-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["gserver" => "id"], "primary" => "1",
662                                 "comment" => "The id of the gserver"],
663                         "tag" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "primary" => "1", "comment" => "Tag that the server has subscribed"],
664                 ],
665                 "indexes" => [
666                         "PRIMARY" => ["gserver-id", "tag"],
667                         "tag" => ["tag"],
668                 ]
669         ],
670         "hook" => [
671                 "comment" => "addon hook registry",
672                 "fields" => [
673                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
674                         "hook" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => "name of hook"],
675                         "file" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "relative filename of hook handler"],
676                         "function" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "function name of hook handler"],
677                         "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"],
678                 ],
679                 "indexes" => [
680                         "PRIMARY" => ["id"],
681                         "hook_file_function" => ["UNIQUE", "hook", "file", "function"],
682                 ]
683         ],
684         "host" => [
685                 "comment" => "Hostname",
686                 "fields" => [
687                         "id" => ["type" => "tinyint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
688                         "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => "The hostname"],
689                 ],
690                 "indexes" => [
691                         "PRIMARY" => ["id"],
692                         "name" => ["UNIQUE", "name"],
693                 ]
694         ],
695         "inbox-status" => [
696                 "comment" => "Status of ActivityPub inboxes",
697                 "fields" => [
698                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URL of the inbox"],
699                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date of this entry"],
700                         "success" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last successful delivery"],
701                         "failure" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of the last failed delivery"],
702                         "previous" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Previous delivery date"],
703                         "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the inbox archived?"],
704                         "shared" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is it a shared inbox?"]
705                 ],
706                 "indexes" => [
707                         "PRIMARY" => ["url"]
708                 ]
709         ],
710         "intro" => [
711                 "comment" => "",
712                 "fields" => [
713                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
714                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
715                         "fid" => ["type" => "int unsigned", "relation" => ["fcontact" => "id"], "comment" => ""],
716                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
717                         "knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
718                         "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
719                         "note" => ["type" => "text", "comment" => ""],
720                         "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
721                         "datetime" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
722                         "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
723                         "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
724                 ],
725                 "indexes" => [
726                         "PRIMARY" => ["id"],
727                         "contact-id" => ["contact-id"],
728                         "uid" => ["uid"],
729                 ]
730         ],
731         "item" => [
732                 "comment" => "Structure for all posts",
733                 "fields" => [
734                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
735                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this item"],
736                         "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
737                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
738                         "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
739                         "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"],
740                         "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "uri of the top-level parent to this item"],
741                         "parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table that contains the top-level parent uri"],
742                         "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"],
743                         "thr-parent-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table that contains the thread parent uri"],
744                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation timestamp."],
745                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last edit (default is created)"],
746                         "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last comment/reply to this item"],
747                         "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime"],
748                         "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"],
749                         "gravity" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
750                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network from where the item comes from"],
751                         "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"],
752                         "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"],
753                         "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"],
754                         "icid" => ["type" => "int unsigned", "relation" => ["item-content" => "id"], "comment" => "Id of the item-content table entry that contains the whole item content"],
755                         "vid" => ["type" => "smallint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
756                         "extid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
757                         "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
758                         "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
759                         "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
760                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
761                         "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
762                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been deleted"],
763                         // User specific fields. Eventually they will move to user-item
764                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
765                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
766                         "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "This item was posted to the wall of uid"],
767                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item originated at this site"],
768                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
769                         "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been favourited"],
770                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "item has not been seen"],
771                         "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "The owner of this item was mentioned in it"],
772                         "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
773                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this post"],
774                         // It has to be decided whether these fields belong to the user or the structure
775                         "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"],
776                         "event-id" => ["type" => "int unsigned", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
777                         // Deprecated fields. Will be removed in upcoming versions
778                         "iaid" => ["type" => "int unsigned", "comment" => "Deprecated"],
779                         "attach" => ["type" => "mediumtext", "comment" => "Deprecated"],
780                         "allow_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
781                         "allow_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
782                         "deny_cid" => ["type" => "mediumtext", "comment" => "Deprecated"],
783                         "deny_gid" => ["type" => "mediumtext", "comment" => "Deprecated"],
784                         "postopts" => ["type" => "text", "comment" => "Deprecated"],
785                         "inform" => ["type" => "mediumtext", "comment" => "Deprecated"],
786                         "type" => ["type" => "varchar(20)", "comment" => "Deprecated"],
787                         "bookmark" => ["type" => "boolean", "comment" => "Deprecated"],
788                         "file" => ["type" => "mediumtext", "comment" => "Deprecated"],
789                         "location" => ["type" => "varchar(255)", "comment" => "Deprecated"],
790                         "coord" => ["type" => "varchar(255)", "comment" => "Deprecated"],
791                         "tag" => ["type" => "mediumtext", "comment" => "Deprecated"],
792                         "plink" => ["type" => "varchar(255)", "comment" => "Deprecated"],
793                         "title" => ["type" => "varchar(255)", "comment" => "Deprecated"],
794                         "content-warning" => ["type" => "varchar(255)", "comment" => "Deprecated"],
795                         "body" => ["type" => "mediumtext", "comment" => "Deprecated"],
796                         "app" => ["type" => "varchar(255)", "comment" => "Deprecated"],
797                         "verb" => ["type" => "varchar(100)", "comment" => "Deprecated"],
798                         "object-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
799                         "object" => ["type" => "text", "comment" => "Deprecated"],
800                         "target-type" => ["type" => "varchar(100)", "comment" => "Deprecated"],
801                         "target" => ["type" => "text", "comment" => "Deprecated"],
802                         "author-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
803                         "author-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
804                         "author-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
805                         "owner-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
806                         "owner-link" => ["type" => "varchar(255)", "comment" => "Deprecated"],
807                         "owner-avatar" => ["type" => "varchar(255)", "comment" => "Deprecated"],
808                         "rendered-hash" => ["type" => "varchar(32)", "comment" => "Deprecated"],
809                         "rendered-html" => ["type" => "mediumtext", "comment" => "Deprecated"],
810                 ],
811                 "indexes" => [
812                         "PRIMARY" => ["id"],
813                         "guid" => ["guid(191)"],
814                         "uri" => ["uri(191)"],
815                         "parent" => ["parent"],
816                         "parent-uri" => ["parent-uri(191)"],
817                         "extid" => ["extid(191)"],
818                         "uid_id" => ["uid", "id"],
819                         "uid_contactid_id" => ["uid", "contact-id", "id"],
820                         "uid_received" => ["uid", "received"],
821                         "uid_commented" => ["uid", "commented"],
822                         "uid_unseen_contactid" => ["uid", "unseen", "contact-id"],
823                         "uid_network_received" => ["uid", "network", "received"],
824                         "uid_network_commented" => ["uid", "network", "commented"],
825                         "uid_thrparent" => ["uid", "thr-parent(190)"],
826                         "uid_parenturi" => ["uid", "parent-uri(190)"],
827                         "uid_contactid_received" => ["uid", "contact-id", "received"],
828                         "authorid_received" => ["author-id", "received"],
829                         "ownerid" => ["owner-id"],
830                         "contact-id" => ["contact-id"],
831                         "uid_uri" => ["uid", "uri(190)"],
832                         "resource-id" => ["resource-id"],
833                         "deleted_changed" => ["deleted", "changed"],
834                         "uid_wall_changed" => ["uid", "wall", "changed"],
835                         "uid_unseen_wall" => ["uid", "unseen", "wall"],
836                         "mention_uid_id" => ["mention", "uid", "id"],
837                         "uid_eventid" => ["uid", "event-id"],
838                         "icid" => ["icid"],
839                         "iaid" => ["iaid"],
840                         "vid" => ["vid"],
841                         "psid_wall" => ["psid", "wall"],
842                         "uri-id" => ["uri-id"],
843                         "parent-uri-id" => ["parent-uri-id"],
844                         "thr-parent-id" => ["thr-parent-id"],
845                         "causer-id" => ["causer-id"],
846                 ]
847         ],
848         "item-activity" => [
849                 "comment" => "Activities for items",
850                 "fields" => [
851                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
852                         "uri" => ["type" => "varchar(255)", "comment" => ""],
853                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
854                         "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
855                         "activity" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""]
856                 ],
857                 "indexes" => [
858                         "PRIMARY" => ["id"],
859                         "uri-hash" => ["UNIQUE", "uri-hash"],
860                         "uri" => ["uri(191)"],
861                         "uri-id" => ["uri-id"]
862                 ]
863         ],
864         "item-content" => [
865                 "comment" => "Content for all posts",
866                 "fields" => [
867                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
868                         "uri" => ["type" => "varchar(255)", "comment" => ""],
869                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
870                         "uri-plink-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
871                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
872                         "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
873                         "body" => ["type" => "mediumtext", "comment" => "item body content"],
874                         "raw-body" => ["type" => "mediumtext", "comment" => "Body without embedded media links"],
875                         "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
876                         "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
877                         "language" => ["type" => "text", "comment" => "Language information about this post"],
878                         "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
879                         "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
880                         "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
881                         "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
882                         "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
883                         "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
884                         "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
885                         "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
886                         "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams verb"]
887                 ],
888                 "indexes" => [
889                         "PRIMARY" => ["id"],
890                         "uri-plink-hash" => ["UNIQUE", "uri-plink-hash"],
891                         "title-content-warning-body" => ["FULLTEXT", "title", "content-warning", "body"],
892                         "uri" => ["uri(191)"],
893                         "plink" => ["plink(191)"],
894                         "uri-id" => ["uri-id"]
895                 ]
896         ],
897         "locks" => [
898                 "comment" => "",
899                 "fields" => [
900                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
901                         "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
902                         "locked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
903                         "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process ID"],
904                         "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
905                 ],
906                 "indexes" => [
907                         "PRIMARY" => ["id"],
908                         "name_expires" => ["name", "expires"]
909                 ]
910         ],
911         "mail" => [
912                 "comment" => "private messages",
913                 "fields" => [
914                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
915                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
916                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this private message"],
917                         "from-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "name of the sender"],
918                         "from-photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "contact photo link of the sender"],
919                         "from-url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "profile linke of the sender"],
920                         "contact-id" => ["type" => "varchar(255)", "relation" => ["contact" => "id"], "comment" => "contact.id"],
921                         "convid" => ["type" => "int unsigned", "relation" => ["conv" => "id"], "comment" => "conv.id"],
922                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
923                         "body" => ["type" => "mediumtext", "comment" => ""],
924                         "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if message visited it is 1"],
925                         "reply" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
926                         "replied" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
927                         "unknown" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if sender not in the contact table this is 1"],
928                         "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
929                         "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
930                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time of the private message"],
931                 ],
932                 "indexes" => [
933                         "PRIMARY" => ["id"],
934                         "uid_seen" => ["uid", "seen"],
935                         "convid" => ["convid"],
936                         "uri" => ["uri(64)"],
937                         "parent-uri" => ["parent-uri(64)"],
938                         "contactid" => ["contact-id(32)"],
939                 ]
940         ],
941         "mailacct" => [
942                 "comment" => "Mail account data for fetching mails",
943                 "fields" => [
944                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
945                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
946                         "server" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
947                         "port" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
948                         "ssltype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
949                         "mailbox" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
950                         "user" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
951                         "pass" => ["type" => "text", "comment" => ""],
952                         "reply_to" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
953                         "action" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
954                         "movetofolder" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
955                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
956                         "last_check" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
957                 ],
958                 "indexes" => [
959                         "PRIMARY" => ["id"],
960                         "uid" => ["uid"],
961                 ]
962         ],
963         "manage" => [
964                 "comment" => "table of accounts that can manage each other",
965                 "fields" => [
966                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
967                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
968                         "mid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
969                 ],
970                 "indexes" => [
971                         "PRIMARY" => ["id"],
972                         "uid_mid" => ["UNIQUE", "uid", "mid"],
973                         "mid" => ["mid"],
974                 ]
975         ],
976         "notify" => [
977                 "comment" => "notifications",
978                 "fields" => [
979                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
980                         "type" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
981                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
982                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
983                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
984                         "date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
985                         "msg" => ["type" => "mediumtext", "comment" => ""],
986                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
987                         "link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
988                         "iid" => ["type" => "int unsigned", "relation" => ["item" => "id"], "comment" => "item.id"],
989                         "parent" => ["type" => "int unsigned", "relation" => ["item" => "id"], "comment" => ""],
990                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of the related post"],
991                         "parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
992                         "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
993                         "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""],
994                         "otype" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => ""],
995                         "name_cache" => ["type" => "tinytext", "comment" => "Cached bbcode parsing of name"],
996                         "msg_cache" => ["type" => "mediumtext", "comment" => "Cached bbcode parsing of msg"]
997                 ],
998                 "indexes" => [
999                         "PRIMARY" => ["id"],
1000                         "seen_uid_date" => ["seen", "uid", "date"],
1001                         "uid_date" => ["uid", "date"],
1002                         "uid_type_link" => ["uid", "type", "link(190)"],
1003                         "uri-id" => ["uri-id"],
1004                         "parent-uri-id" => ["parent-uri-id"],
1005                 ]
1006         ],
1007         "notify-threads" => [
1008                 "comment" => "",
1009                 "fields" => [
1010                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1011                         "notify-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["notify" => "id"], "comment" => ""],
1012                         "master-parent-item" => ["type" => "int unsigned", "foreign" => ["item" => "id"], "comment" => ""],
1013                         "master-parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
1014                         "parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1015                         "receiver-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"],
1016                                 "comment" => "User id"],
1017                 ],
1018                 "indexes" => [
1019                         "PRIMARY" => ["id"],
1020                         "master-parent-item" => ["master-parent-item"],
1021                         "master-parent-uri-id" => ["master-parent-uri-id"],
1022                         "receiver-uid" => ["receiver-uid"],
1023                         "notify-id" => ["notify-id"],
1024                 ]
1025         ],
1026         "oembed" => [
1027                 "comment" => "cache for OEmbed queries",
1028                 "fields" => [
1029                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1030                         "maxwidth" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "comment" => "Maximum width passed to Oembed"],
1031                         "content" => ["type" => "mediumtext", "comment" => "OEmbed data of the page"],
1032                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1033                 ],
1034                 "indexes" => [
1035                         "PRIMARY" => ["url", "maxwidth"],
1036                         "created" => ["created"],
1037                 ]
1038         ],
1039         "openwebauth-token" => [
1040                 "comment" => "Store OpenWebAuth token to verify contacts",
1041                 "fields" => [
1042                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1043                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id - currently unused"],
1044                         "type" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Verify type"],
1045                         "token" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A generated token"],
1046                         "meta" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1047                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1048                 ],
1049                 "indexes" => [
1050                         "PRIMARY" => ["id"],
1051                         "uid" => ["uid"],
1052                 ]
1053         ],
1054         "parsed_url" => [
1055                 "comment" => "cache for 'parse_url' queries",
1056                 "fields" => [
1057                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1058                         "guessing" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the 'guessing' mode active?"],
1059                         "oembed" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the data the result of oembed?"],
1060                         "content" => ["type" => "mediumtext", "comment" => "page data"],
1061                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1062                 ],
1063                 "indexes" => [
1064                         "PRIMARY" => ["url", "guessing", "oembed"],
1065                         "created" => ["created"],
1066                 ]
1067         ],
1068         "participation" => [
1069                 "comment" => "Storage for participation messages from Diaspora",
1070                 "fields" => [
1071                         "iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item" => "id"], "comment" => ""],
1072                         "server" => ["type" => "varchar(60)", "not null" => "1", "primary" => "1", "comment" => ""],
1073                         "cid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["contact" => "id"], "comment" => ""],
1074                         "fid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["fcontact" => "id"], "comment" => ""],
1075                 ],
1076                 "indexes" => [
1077                         "PRIMARY" => ["iid", "server"],
1078                         "cid" => ["cid"],
1079                         "fid" => ["fid"]
1080                 ]
1081         ],
1082         "pconfig" => [
1083                 "comment" => "personal (per user) configuration storage",
1084                 "fields" => [
1085                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Primary key"],
1086                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1087                         "cat" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "Category"],
1088                         "k" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "Key"],
1089                         "v" => ["type" => "mediumtext", "comment" => "Value"],
1090                 ],
1091                 "indexes" => [
1092                         "PRIMARY" => ["id"],
1093                         "uid_cat_k" => ["UNIQUE", "uid", "cat", "k"],
1094                 ]
1095         ],
1096         "photo" => [
1097                 "comment" => "photo storage",
1098                 "fields" => [
1099                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1100                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid", "on delete" => "restrict"], "comment" => "Owner User id"],
1101                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "contact.id"],
1102                         "guid" => ["type" => "char(16)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this photo"],
1103                         "resource-id" => ["type" => "char(32)", "not null" => "1", "default" => "", "comment" => ""],
1104                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation date"],
1105                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edited date"],
1106                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1107                         "desc" => ["type" => "text", "comment" => ""],
1108                         "album" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "The name of the album to which the photo belongs"],
1109                         "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1110                         "type" => ["type" => "varchar(30)", "not null" => "1", "default" => "image/jpeg"],
1111                         "height" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1112                         "width" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1113                         "datasize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1114                         "data" => ["type" => "mediumblob", "not null" => "1", "comment" => ""],
1115                         "scale" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1116                         "profile" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1117                         "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
1118                         "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
1119                         "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
1120                         "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
1121                         "accessible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Make photo publicly accessible, ignoring permissions"],
1122                         "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
1123                         "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
1124                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
1125                 ],
1126                 "indexes" => [
1127                         "PRIMARY" => ["id"],
1128                         "contactid" => ["contact-id"],
1129                         "uid_contactid" => ["uid", "contact-id"],
1130                         "uid_profile" => ["uid", "profile"],
1131                         "uid_album_scale_created" => ["uid", "album(32)", "scale", "created"],
1132                         "uid_album_resource-id_created" => ["uid", "album(32)", "resource-id", "created"],
1133                         "resource-id" => ["resource-id"],
1134                 ]
1135         ],
1136         "post-category" => [
1137                 "comment" => "post relation to categories",
1138                 "fields" => [
1139                         "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"],
1140                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1141                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1142                         "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1143                 ],
1144                 "indexes" => [
1145                         "PRIMARY" => ["uri-id", "uid", "type", "tid"],
1146                         "uri-id" => ["tid"],
1147                         "uid" => ["uid"],
1148                 ]
1149         ],
1150         "post-delivery-data" => [
1151                 "comment" => "Delivery data for items",
1152                 "fields" => [
1153                         "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"],
1154                         "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"],
1155                         "inform" => ["type" => "mediumtext", "comment" => "Additional receivers of the linked item"],
1156                         "queue_count" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Initial number of delivery recipients, used as item.delivery_queue_count"],
1157                         "queue_done" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries, used as item.delivery_queue_done"],
1158                         "queue_failed" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of unsuccessful deliveries, used as item.delivery_queue_failed"],
1159                         "activitypub" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via ActivityPub"],
1160                         "dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via DFRN"],
1161                         "legacy_dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via legacy DFRN"],
1162                         "diaspora" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via Diaspora"],
1163                         "ostatus" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via OStatus"],
1164                 ],
1165                 "indexes" => [
1166                         "PRIMARY" => ["uri-id"],
1167                 ]
1168         ],
1169         "post-media" => [
1170                 "comment" => "Attached media",
1171                 "fields" => [
1172                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1173                         "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"],
1174                         "url" => ["type" => "varbinary(511)", "not null" => "1", "comment" => "Media URL"],
1175                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Media type"],
1176                         "mimetype" => ["type" => "varchar(60)", "comment" => ""],
1177                         "height" => ["type" => "smallint unsigned", "comment" => "Height of the media"],
1178                         "width" => ["type" => "smallint unsigned", "comment" => "Width of the media"],
1179                         "size" => ["type" => "int unsigned", "comment" => "Media size"],
1180                         "preview" => ["type" => "varbinary(255)", "comment" => "Preview URL"],
1181                         "preview-height" => ["type" => "smallint unsigned", "comment" => "Height of the preview picture"],
1182                         "preview-width" => ["type" => "smallint unsigned", "comment" => "Width of the preview picture"],
1183                         "description" => ["type" => "text", "comment" => ""],
1184                 ],
1185                 "indexes" => [
1186                         "PRIMARY" => ["id"],
1187                         "uri-id-url" => ["UNIQUE", "uri-id", "url"],
1188                 ]
1189         ],
1190         "post-tag" => [
1191                 "comment" => "post relation to tags",
1192                 "fields" => [
1193                         "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"],
1194                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1195                         "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1196                         "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"],
1197                 ],
1198                 "indexes" => [
1199                         "PRIMARY" => ["uri-id", "type", "tid", "cid"],
1200                         "tid" => ["tid"],
1201                         "cid" => ["cid"]
1202                 ]
1203         ],
1204         "post-user" => [
1205                 "comment" => "User specific post data",
1206                 "fields" => [
1207                         "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"],
1208                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
1209                         "protocol" => ["type" => "tinyint unsigned", "comment" => "Protocol used to deliver the item for this user"],
1210                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
1211                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "post has not been seen"],
1212                         "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide the post from the user"],
1213                         "notification-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1214                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item originated at this site"],
1215                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this post"],
1216                 ],
1217                 "indexes" => [
1218                         "PRIMARY" => ["uid", "uri-id"],
1219                         "uri-id" => ["uri-id"],
1220                         "contact-id" => ["contact-id"],
1221                         "psid" => ["psid"],
1222                 ],
1223         ],
1224         "process" => [
1225                 "comment" => "Currently running system processes",
1226                 "fields" => [
1227                         "pid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "comment" => ""],
1228                         "command" => ["type" => "varbinary(32)", "not null" => "1", "default" => "", "comment" => ""],
1229                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1230                 ],
1231                 "indexes" => [
1232                         "PRIMARY" => ["pid"],
1233                         "command" => ["command"],
1234                 ]
1235         ],
1236         "profile" => [
1237                 "comment" => "user profiles data",
1238                 "fields" => [
1239                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1240                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
1241                         "profile-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1242                         "is-default" => ["type" => "boolean", "comment" => "Deprecated"],
1243                         "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide friend list from viewers of this profile"],
1244                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1245                         "pdesc" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1246                         "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => "Day of birth"],
1247                         "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1248                         "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1249                         "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1250                         "postal-code" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1251                         "country-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1252                         "hometown" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1253                         "gender" => ["type" => "varchar(32)", "comment" => "Deprecated"],
1254                         "marital" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1255                         "with" => ["type" => "text", "comment" => "Deprecated"],
1256                         "howlong" => ["type" => "datetime", "comment" => "Deprecated"],
1257                         "sexual" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1258                         "politic" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1259                         "religion" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1260                         "pub_keywords" => ["type" => "text", "comment" => ""],
1261                         "prv_keywords" => ["type" => "text", "comment" => ""],
1262                         "likes" => ["type" => "text", "comment" => "Deprecated"],
1263                         "dislikes" => ["type" => "text", "comment" => "Deprecated"],
1264                         "about" => ["type" => "text", "comment" => "Profile description"],
1265                         "summary" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1266                         "music" => ["type" => "text", "comment" => "Deprecated"],
1267                         "book" => ["type" => "text", "comment" => "Deprecated"],
1268                         "tv" => ["type" => "text", "comment" => "Deprecated"],
1269                         "film" => ["type" => "text", "comment" => "Deprecated"],
1270                         "interest" => ["type" => "text", "comment" => "Deprecated"],
1271                         "romance" => ["type" => "text", "comment" => "Deprecated"],
1272                         "work" => ["type" => "text", "comment" => "Deprecated"],
1273                         "education" => ["type" => "text", "comment" => "Deprecated"],
1274                         "contact" => ["type" => "text", "comment" => "Deprecated"],
1275                         "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1276                         "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1277                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1278                         "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1279                         "publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish default profile in local directory"],
1280                         "net-publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish profile in global directory"],
1281                 ],
1282                 "indexes" => [
1283                         "PRIMARY" => ["id"],
1284                         "uid_is-default" => ["uid", "is-default"],
1285                         "pub_keywords" => ["FULLTEXT", "pub_keywords"],
1286                 ]
1287         ],
1288         "profile_check" => [
1289                 "comment" => "DFRN remote auth use",
1290                 "fields" => [
1291                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1292                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1293                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
1294                         "dfrn_id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1295                         "sec" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1296                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1297                 ],
1298                 "indexes" => [
1299                         "PRIMARY" => ["id"],
1300                         "uid" => ["uid"],
1301                         "cid" => ["cid"],
1302                 ]
1303         ],
1304         "profile_field" => [
1305                 "comment" => "Custom profile fields",
1306                 "fields" => [
1307                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1308                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner user id"],
1309                         "order" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "1", "comment" => "Field ordering per user"],
1310                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this profile field - 0 = public"],
1311                         "label" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Label of the field"],
1312                         "value" => ["type" => "text", "comment" => "Value of the field"],
1313                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
1314                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
1315                 ],
1316                 "indexes" => [
1317                         "PRIMARY" => ["id"],
1318                         "uid" => ["uid"],
1319                         "order" => ["order"],
1320                         "psid" => ["psid"],
1321                 ]
1322         ],
1323         "push_subscriber" => [
1324                 "comment" => "Used for OStatus: Contains feed subscribers",
1325                 "fields" => [
1326                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1327                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1328                         "callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1329                         "topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1330                         "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1331                         "push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1332                         "last_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last successful trial"],
1333                         "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1334                         "renewed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last subscription renewal"],
1335                         "secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1336                 ],
1337                 "indexes" => [
1338                         "PRIMARY" => ["id"],
1339                         "next_try" => ["next_try"],
1340                         "uid" => ["uid"]
1341                 ]
1342         ],
1343         "register" => [
1344                 "comment" => "registrations requiring admin approval",
1345                 "fields" => [
1346                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1347                         "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1348                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1349                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1350                         "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1351                         "language" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1352                         "note" => ["type" => "text", "comment" => ""],
1353                 ],
1354                 "indexes" => [
1355                         "PRIMARY" => ["id"],
1356                         "uid" => ["uid"],
1357                 ]
1358         ],
1359         "search" => [
1360                 "comment" => "",
1361                 "fields" => [
1362                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1363                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1364                         "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1365                 ],
1366                 "indexes" => [
1367                         "PRIMARY" => ["id"],
1368                         "uid" => ["uid"],
1369                 ]
1370         ],
1371         "session" => [
1372                 "comment" => "web session storage",
1373                 "fields" => [
1374                         "id" => ["type" => "bigint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1375                         "sid" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1376                         "data" => ["type" => "text", "comment" => ""],
1377                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1378                 ],
1379                 "indexes" => [
1380                         "PRIMARY" => ["id"],
1381                         "sid" => ["sid(64)"],
1382                         "expire" => ["expire"],
1383                 ]
1384         ],
1385         "storage" => [
1386                 "comment" => "Data stored by Database storage backend",
1387                 "fields" => [
1388                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented image data id"],
1389                         "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"]
1390                 ],
1391                 "indexes" => [
1392                         "PRIMARY" => ["id"]
1393                 ]
1394         ],
1395         "thread" => [
1396                 "comment" => "Thread related data",
1397                 "fields" => [
1398                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"],
1399                                 "comment" => "sequential ID"],
1400                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
1401                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1402                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
1403                         "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Item owner"],
1404                         "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Item author"],
1405                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1406                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1407                         "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1408                         "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1409                         "changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1410                         "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1411                         "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
1412                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1413                         "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1414                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1415                         "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1416                         "ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1417                         "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
1418                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1419                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1420                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1421                         "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1422                         "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1423                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
1424                         "bookmark" => ["type" => "boolean", "comment" => ""],
1425                 ],
1426                 "indexes" => [
1427                         "PRIMARY" => ["iid"],
1428                         "uid_network_commented" => ["uid", "network", "commented"],
1429                         "uid_network_received" => ["uid", "network", "received"],
1430                         "uid_contactid_commented" => ["uid", "contact-id", "commented"],
1431                         "uid_contactid_received" => ["uid", "contact-id", "received"],
1432                         "contactid" => ["contact-id"],
1433                         "ownerid" => ["owner-id"],
1434                         "authorid" => ["author-id"],
1435                         "uid_received" => ["uid", "received"],
1436                         "uid_commented" => ["uid", "commented"],
1437                         "uid_wall_received" => ["uid", "wall", "received"],
1438                         "private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
1439                         "uri-id" => ["uri-id"],
1440                 ]
1441         ],
1442         "tokens" => [
1443                 "comment" => "OAuth usage",
1444                 "fields" => [
1445                         "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
1446                         "secret" => ["type" => "text", "comment" => ""],
1447                         "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"]],
1448                         "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1449                         "scope" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
1450                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1451                 ],
1452                 "indexes" => [
1453                         "PRIMARY" => ["id"],
1454                         "client_id" => ["client_id"],
1455                         "uid" => ["uid"]
1456                 ]
1457         ],
1458         "userd" => [
1459                 "comment" => "Deleted usernames",
1460                 "fields" => [
1461                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1462                         "username" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
1463                 ],
1464                 "indexes" => [
1465                         "PRIMARY" => ["id"],
1466                         "username" => ["username(32)"],
1467                 ]
1468         ],
1469         "user-contact" => [
1470                 "comment" => "User specific public contact data",
1471                 "fields" => [
1472                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["contact" => "id"], "comment" => "Contact id of the linked public contact"],
1473                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1474                         "blocked" => ["type" => "boolean", "comment" => "Contact is completely blocked for this user"],
1475                         "ignored" => ["type" => "boolean", "comment" => "Posts from this contact are ignored"],
1476                         "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"]
1477                 ],
1478                 "indexes" => [
1479                         "PRIMARY" => ["uid", "cid"],
1480                         "cid" => ["cid"],
1481                 ]
1482         ],
1483         "user-item" => [
1484                 "comment" => "User specific item data",
1485                 "fields" => [
1486                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"], "comment" => "Item id"],
1487                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1488                         "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
1489                         "ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
1490                         "pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"],
1491                         "notification-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1492                 ],
1493                 "indexes" => [
1494                         "PRIMARY" => ["uid", "iid"],
1495                         "uid_pinned" => ["uid", "pinned"],
1496                         "iid_uid" => ["iid", "uid"]
1497                 ]
1498         ],
1499         "worker-ipc" => [
1500                 "comment" => "Inter process communication between the frontend and the worker",
1501                 "fields" => [
1502                         "key" => ["type" => "int", "not null" => "1", "primary" => "1", "comment" => ""],
1503                         "jobs" => ["type" => "boolean", "comment" => "Flag for outstanding jobs"],
1504                 ],
1505                 "indexes" => [
1506                         "PRIMARY" => ["key"],
1507                 ],
1508                 "engine" => "MEMORY",
1509         ],
1510         "workerqueue" => [
1511                 "comment" => "Background tasks queue entries",
1512                 "fields" => [
1513                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
1514                         "command" => ["type" => "varchar(100)", "comment" => "Task command"],
1515                         "parameter" => ["type" => "mediumtext", "comment" => "Task parameter"],
1516                         "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"],
1517                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"],
1518                         "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
1519                         "executed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Execution date"],
1520                         "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1521                         "retrial" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1522                         "done" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marked 1 when the task was done - will be deleted later"],
1523                 ],
1524                 "indexes" => [
1525                         "PRIMARY" => ["id"],
1526                         "command" => ["command"],
1527                         "done_command_parameter" => ["done", "command", "parameter(64)"],
1528                         "done_executed" => ["done", "executed"],
1529                         "done_priority_retrial_created" => ["done", "priority", "retrial", "created"],
1530                         "done_priority_next_try" => ["done", "priority", "next_try"],
1531                         "done_pid_next_try" => ["done", "pid", "next_try"],
1532                         "done_pid_retrial" => ["done", "pid", "retrial"],
1533                         "done_pid_priority_created" => ["done", "pid", "priority", "created"]
1534                 ]
1535         ],
1536 ];