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