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