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