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