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