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