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