]> git.mxchange.org Git - friendica.git/blob - static/dbstructure.config.php
Merge pull request #9821 from annando/post-duplicates
[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', 1391);
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                         "icid" => ["type" => "int unsigned", "relation" => ["item-content" => "id"], "comment" => "Id of the item-content table entry that contains the whole item content"],
756                         "vid" => ["type" => "smallint unsigned", "foreign" => ["verb" => "id", "on delete" => "restrict"], "comment" => "Id of the verb table entry that contains the activity verbs"],
757                         "extid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
758                         "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
759                         "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
760                         "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
761                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
762                         "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
763                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been deleted"],
764                         // User specific fields. Eventually they will move to user-item
765                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
766                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
767                         "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "This item was posted to the wall of uid"],
768                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item originated at this site"],
769                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
770                         "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been favourited"],
771                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "item has not been seen"],
772                         "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "The owner of this item was mentioned in it"],
773                         "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
774                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this post"],
775                         // It has to be decided whether these fields belong to the user or the structure
776                         "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"],
777                         "event-id" => ["type" => "int unsigned", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
778                         // Deprecated fields. Will be removed in upcoming versions
779                         "iaid" => ["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                         "icid" => ["icid"],
840                         "iaid" => ["iaid"],
841                         "vid" => ["vid"],
842                         "psid_wall" => ["psid", "wall"],
843                         "uri-id" => ["uri-id"],
844                         "parent-uri-id" => ["parent-uri-id"],
845                         "thr-parent-id" => ["thr-parent-id"],
846                         "causer-id" => ["causer-id"],
847                 ]
848         ],
849         "item-activity" => [
850                 "comment" => "Activities for items",
851                 "fields" => [
852                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
853                         "uri" => ["type" => "varchar(255)", "comment" => ""],
854                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
855                         "uri-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
856                         "activity" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""]
857                 ],
858                 "indexes" => [
859                         "PRIMARY" => ["id"],
860                         "uri-hash" => ["UNIQUE", "uri-hash"],
861                         "uri" => ["uri(191)"],
862                         "uri-id" => ["uri-id"]
863                 ]
864         ],
865         "item-content" => [
866                 "comment" => "Content for all posts",
867                 "fields" => [
868                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"],
869                         "uri" => ["type" => "varchar(255)", "comment" => ""],
870                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
871                         "uri-plink-hash" => ["type" => "varchar(80)", "not null" => "1", "default" => "", "comment" => "RIPEMD-128 hash from uri"],
872                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
873                         "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
874                         "body" => ["type" => "mediumtext", "comment" => "item body content"],
875                         "raw-body" => ["type" => "mediumtext", "comment" => "Body without embedded media links"],
876                         "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
877                         "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
878                         "language" => ["type" => "text", "comment" => "Language information about this post"],
879                         "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
880                         "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
881                         "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
882                         "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
883                         "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
884                         "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
885                         "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
886                         "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
887                         "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams verb"]
888                 ],
889                 "indexes" => [
890                         "PRIMARY" => ["id"],
891                         "uri-plink-hash" => ["UNIQUE", "uri-plink-hash"],
892                         "title-content-warning-body" => ["FULLTEXT", "title", "content-warning", "body"],
893                         "uri" => ["uri(191)"],
894                         "plink" => ["plink(191)"],
895                         "uri-id" => ["uri-id"]
896                 ]
897         ],
898         "locks" => [
899                 "comment" => "",
900                 "fields" => [
901                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
902                         "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
903                         "locked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
904                         "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process ID"],
905                         "expires" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of cache expiration"],
906                 ],
907                 "indexes" => [
908                         "PRIMARY" => ["id"],
909                         "name_expires" => ["name", "expires"]
910                 ]
911         ],
912         "mail" => [
913                 "comment" => "private messages",
914                 "fields" => [
915                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
916                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
917                         "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this private message"],
918                         "from-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "name of the sender"],
919                         "from-photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "contact photo link of the sender"],
920                         "from-url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "profile linke of the sender"],
921                         "contact-id" => ["type" => "varchar(255)", "relation" => ["contact" => "id"], "comment" => "contact.id"],
922                         "convid" => ["type" => "int unsigned", "relation" => ["conv" => "id"], "comment" => "conv.id"],
923                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
924                         "body" => ["type" => "mediumtext", "comment" => ""],
925                         "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if message visited it is 1"],
926                         "reply" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
927                         "replied" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
928                         "unknown" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if sender not in the contact table this is 1"],
929                         "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
930                         "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
931                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time of the private message"],
932                 ],
933                 "indexes" => [
934                         "PRIMARY" => ["id"],
935                         "uid_seen" => ["uid", "seen"],
936                         "convid" => ["convid"],
937                         "uri" => ["uri(64)"],
938                         "parent-uri" => ["parent-uri(64)"],
939                         "contactid" => ["contact-id(32)"],
940                 ]
941         ],
942         "mailacct" => [
943                 "comment" => "Mail account data for fetching mails",
944                 "fields" => [
945                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
946                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
947                         "server" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
948                         "port" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
949                         "ssltype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
950                         "mailbox" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
951                         "user" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
952                         "pass" => ["type" => "text", "comment" => ""],
953                         "reply_to" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
954                         "action" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
955                         "movetofolder" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
956                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
957                         "last_check" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
958                 ],
959                 "indexes" => [
960                         "PRIMARY" => ["id"],
961                         "uid" => ["uid"],
962                 ]
963         ],
964         "manage" => [
965                 "comment" => "table of accounts that can manage each other",
966                 "fields" => [
967                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
968                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
969                         "mid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
970                 ],
971                 "indexes" => [
972                         "PRIMARY" => ["id"],
973                         "uid_mid" => ["UNIQUE", "uid", "mid"],
974                         "mid" => ["mid"],
975                 ]
976         ],
977         "notify" => [
978                 "comment" => "notifications",
979                 "fields" => [
980                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
981                         "type" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
982                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
983                         "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
984                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
985                         "date" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
986                         "msg" => ["type" => "mediumtext", "comment" => ""],
987                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
988                         "link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
989                         "iid" => ["type" => "int unsigned", "relation" => ["item" => "id"], "comment" => "item.id"],
990                         "parent" => ["type" => "int unsigned", "relation" => ["item" => "id"], "comment" => ""],
991                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of the related post"],
992                         "parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
993                         "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
994                         "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""],
995                         "otype" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => ""],
996                         "name_cache" => ["type" => "tinytext", "comment" => "Cached bbcode parsing of name"],
997                         "msg_cache" => ["type" => "mediumtext", "comment" => "Cached bbcode parsing of msg"]
998                 ],
999                 "indexes" => [
1000                         "PRIMARY" => ["id"],
1001                         "seen_uid_date" => ["seen", "uid", "date"],
1002                         "uid_date" => ["uid", "date"],
1003                         "uid_type_link" => ["uid", "type", "link(190)"],
1004                         "uri-id" => ["uri-id"],
1005                         "parent-uri-id" => ["parent-uri-id"],
1006                 ]
1007         ],
1008         "notify-threads" => [
1009                 "comment" => "",
1010                 "fields" => [
1011                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1012                         "notify-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["notify" => "id"], "comment" => ""],
1013                         "master-parent-item" => ["type" => "int unsigned", "foreign" => ["item" => "id"], "comment" => ""],
1014                         "master-parent-uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Item-uri id of the parent of the related post"],
1015                         "parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1016                         "receiver-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"],
1017                                 "comment" => "User id"],
1018                 ],
1019                 "indexes" => [
1020                         "PRIMARY" => ["id"],
1021                         "master-parent-item" => ["master-parent-item"],
1022                         "master-parent-uri-id" => ["master-parent-uri-id"],
1023                         "receiver-uid" => ["receiver-uid"],
1024                         "notify-id" => ["notify-id"],
1025                 ]
1026         ],
1027         "oembed" => [
1028                 "comment" => "cache for OEmbed queries",
1029                 "fields" => [
1030                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1031                         "maxwidth" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "comment" => "Maximum width passed to Oembed"],
1032                         "content" => ["type" => "mediumtext", "comment" => "OEmbed data of the page"],
1033                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1034                 ],
1035                 "indexes" => [
1036                         "PRIMARY" => ["url", "maxwidth"],
1037                         "created" => ["created"],
1038                 ]
1039         ],
1040         "openwebauth-token" => [
1041                 "comment" => "Store OpenWebAuth token to verify contacts",
1042                 "fields" => [
1043                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1044                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id - currently unused"],
1045                         "type" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Verify type"],
1046                         "token" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A generated token"],
1047                         "meta" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1048                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1049                 ],
1050                 "indexes" => [
1051                         "PRIMARY" => ["id"],
1052                         "uid" => ["uid"],
1053                 ]
1054         ],
1055         "parsed_url" => [
1056                 "comment" => "cache for 'parse_url' queries",
1057                 "fields" => [
1058                         "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1059                         "guessing" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the 'guessing' mode active?"],
1060                         "oembed" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the data the result of oembed?"],
1061                         "content" => ["type" => "mediumtext", "comment" => "page data"],
1062                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "datetime of creation"],
1063                 ],
1064                 "indexes" => [
1065                         "PRIMARY" => ["url", "guessing", "oembed"],
1066                         "created" => ["created"],
1067                 ]
1068         ],
1069         "participation" => [
1070                 "comment" => "Storage for participation messages from Diaspora",
1071                 "fields" => [
1072                         "iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item" => "id"], "comment" => ""],
1073                         "server" => ["type" => "varchar(60)", "not null" => "1", "primary" => "1", "comment" => ""],
1074                         "cid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["contact" => "id"], "comment" => ""],
1075                         "fid" => ["type" => "int unsigned", "not null" => "1", "foreign" => ["fcontact" => "id"], "comment" => ""],
1076                 ],
1077                 "indexes" => [
1078                         "PRIMARY" => ["iid", "server"],
1079                         "cid" => ["cid"],
1080                         "fid" => ["fid"]
1081                 ]
1082         ],
1083         "pconfig" => [
1084                 "comment" => "personal (per user) configuration storage",
1085                 "fields" => [
1086                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Primary key"],
1087                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1088                         "cat" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "Category"],
1089                         "k" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "Key"],
1090                         "v" => ["type" => "mediumtext", "comment" => "Value"],
1091                 ],
1092                 "indexes" => [
1093                         "PRIMARY" => ["id"],
1094                         "uid_cat_k" => ["UNIQUE", "uid", "cat", "k"],
1095                 ]
1096         ],
1097         "photo" => [
1098                 "comment" => "photo storage",
1099                 "fields" => [
1100                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1101                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid", "on delete" => "restrict"], "comment" => "Owner User id"],
1102                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "contact.id"],
1103                         "guid" => ["type" => "char(16)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this photo"],
1104                         "resource-id" => ["type" => "char(32)", "not null" => "1", "default" => "", "comment" => ""],
1105                         "hash" => ["type" => "char(32)", "comment" => "hash value of the photo"],
1106                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation date"],
1107                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edited date"],
1108                         "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1109                         "desc" => ["type" => "text", "comment" => ""],
1110                         "album" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "The name of the album to which the photo belongs"],
1111                         "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1112                         "type" => ["type" => "varchar(30)", "not null" => "1", "default" => "image/jpeg"],
1113                         "height" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1114                         "width" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1115                         "datasize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1116                         "data" => ["type" => "mediumblob", "not null" => "1", "comment" => ""],
1117                         "scale" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1118                         "profile" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1119                         "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
1120                         "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
1121                         "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
1122                         "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
1123                         "accessible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Make photo publicly accessible, ignoring permissions"],
1124                         "backend-class" => ["type" => "tinytext", "comment" => "Storage backend class"],
1125                         "backend-ref" => ["type" => "text", "comment" => "Storage backend data reference"],
1126                         "updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
1127                 ],
1128                 "indexes" => [
1129                         "PRIMARY" => ["id"],
1130                         "contactid" => ["contact-id"],
1131                         "uid_contactid" => ["uid", "contact-id"],
1132                         "uid_profile" => ["uid", "profile"],
1133                         "uid_album_scale_created" => ["uid", "album(32)", "scale", "created"],
1134                         "uid_album_resource-id_created" => ["uid", "album(32)", "resource-id", "created"],
1135                         "resource-id" => ["resource-id"],
1136                 ]
1137         ],
1138         "post-category" => [
1139                 "comment" => "post relation to categories",
1140                 "fields" => [
1141                         "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"],
1142                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1143                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1144                         "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1145                 ],
1146                 "indexes" => [
1147                         "PRIMARY" => ["uri-id", "uid", "type", "tid"],
1148                         "uri-id" => ["tid"],
1149                         "uid" => ["uid"],
1150                 ]
1151         ],
1152         "post-delivery-data" => [
1153                 "comment" => "Delivery data for items",
1154                 "fields" => [
1155                         "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"],
1156                         "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"],
1157                         "inform" => ["type" => "mediumtext", "comment" => "Additional receivers of the linked item"],
1158                         "queue_count" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Initial number of delivery recipients, used as item.delivery_queue_count"],
1159                         "queue_done" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries, used as item.delivery_queue_done"],
1160                         "queue_failed" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of unsuccessful deliveries, used as item.delivery_queue_failed"],
1161                         "activitypub" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via ActivityPub"],
1162                         "dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via DFRN"],
1163                         "legacy_dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via legacy DFRN"],
1164                         "diaspora" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via Diaspora"],
1165                         "ostatus" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via OStatus"],
1166                 ],
1167                 "indexes" => [
1168                         "PRIMARY" => ["uri-id"],
1169                 ]
1170         ],
1171         "post-media" => [
1172                 "comment" => "Attached media",
1173                 "fields" => [
1174                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1175                         "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"],
1176                         "url" => ["type" => "varbinary(511)", "not null" => "1", "comment" => "Media URL"],
1177                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Media type"],
1178                         "mimetype" => ["type" => "varchar(60)", "comment" => ""],
1179                         "height" => ["type" => "smallint unsigned", "comment" => "Height of the media"],
1180                         "width" => ["type" => "smallint unsigned", "comment" => "Width of the media"],
1181                         "size" => ["type" => "int unsigned", "comment" => "Media size"],
1182                         "preview" => ["type" => "varbinary(255)", "comment" => "Preview URL"],
1183                         "preview-height" => ["type" => "smallint unsigned", "comment" => "Height of the preview picture"],
1184                         "preview-width" => ["type" => "smallint unsigned", "comment" => "Width of the preview picture"],
1185                         "description" => ["type" => "text", "comment" => ""],
1186                 ],
1187                 "indexes" => [
1188                         "PRIMARY" => ["id"],
1189                         "uri-id-url" => ["UNIQUE", "uri-id", "url"],
1190                 ]
1191         ],
1192         "post-tag" => [
1193                 "comment" => "post relation to tags",
1194                 "fields" => [
1195                         "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"],
1196                         "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1197                         "tid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["tag" => "id", "on delete" => "restrict"], "comment" => ""],
1198                         "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"],
1199                 ],
1200                 "indexes" => [
1201                         "PRIMARY" => ["uri-id", "type", "tid", "cid"],
1202                         "tid" => ["tid"],
1203                         "cid" => ["cid"]
1204                 ]
1205         ],
1206         "post-user" => [
1207                 "comment" => "User specific post data",
1208                 "fields" => [
1209                         "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"],
1210                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
1211                         "protocol" => ["type" => "tinyint unsigned", "comment" => "Protocol used to deliver the item for this user"],
1212                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
1213                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "post has not been seen"],
1214                         "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide the post from the user"],
1215                         "notification-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1216                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item originated at this site"],
1217                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this post"],
1218                 ],
1219                 "indexes" => [
1220                         "PRIMARY" => ["uid", "uri-id"],
1221                         "uri-id" => ["uri-id"],
1222                         "contact-id" => ["contact-id"],
1223                         "psid" => ["psid"],
1224                 ],
1225         ],
1226         "process" => [
1227                 "comment" => "Currently running system processes",
1228                 "fields" => [
1229                         "pid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "comment" => ""],
1230                         "command" => ["type" => "varbinary(32)", "not null" => "1", "default" => "", "comment" => ""],
1231                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1232                 ],
1233                 "indexes" => [
1234                         "PRIMARY" => ["pid"],
1235                         "command" => ["command"],
1236                 ]
1237         ],
1238         "profile" => [
1239                 "comment" => "user profiles data",
1240                 "fields" => [
1241                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1242                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner User id"],
1243                         "profile-name" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1244                         "is-default" => ["type" => "boolean", "comment" => "Deprecated"],
1245                         "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide friend list from viewers of this profile"],
1246                         "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1247                         "pdesc" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1248                         "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => "Day of birth"],
1249                         "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1250                         "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1251                         "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1252                         "postal-code" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1253                         "country-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1254                         "hometown" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1255                         "gender" => ["type" => "varchar(32)", "comment" => "Deprecated"],
1256                         "marital" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1257                         "with" => ["type" => "text", "comment" => "Deprecated"],
1258                         "howlong" => ["type" => "datetime", "comment" => "Deprecated"],
1259                         "sexual" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1260                         "politic" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1261                         "religion" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1262                         "pub_keywords" => ["type" => "text", "comment" => ""],
1263                         "prv_keywords" => ["type" => "text", "comment" => ""],
1264                         "likes" => ["type" => "text", "comment" => "Deprecated"],
1265                         "dislikes" => ["type" => "text", "comment" => "Deprecated"],
1266                         "about" => ["type" => "text", "comment" => "Profile description"],
1267                         "summary" => ["type" => "varchar(255)", "comment" => "Deprecated"],
1268                         "music" => ["type" => "text", "comment" => "Deprecated"],
1269                         "book" => ["type" => "text", "comment" => "Deprecated"],
1270                         "tv" => ["type" => "text", "comment" => "Deprecated"],
1271                         "film" => ["type" => "text", "comment" => "Deprecated"],
1272                         "interest" => ["type" => "text", "comment" => "Deprecated"],
1273                         "romance" => ["type" => "text", "comment" => "Deprecated"],
1274                         "work" => ["type" => "text", "comment" => "Deprecated"],
1275                         "education" => ["type" => "text", "comment" => "Deprecated"],
1276                         "contact" => ["type" => "text", "comment" => "Deprecated"],
1277                         "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1278                         "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1279                         "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1280                         "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1281                         "publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish default profile in local directory"],
1282                         "net-publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish profile in global directory"],
1283                 ],
1284                 "indexes" => [
1285                         "PRIMARY" => ["id"],
1286                         "uid_is-default" => ["uid", "is-default"],
1287                         "pub_keywords" => ["FULLTEXT", "pub_keywords"],
1288                 ]
1289         ],
1290         "profile_check" => [
1291                 "comment" => "DFRN remote auth use",
1292                 "fields" => [
1293                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1294                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1295                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => "contact.id"],
1296                         "dfrn_id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1297                         "sec" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1298                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1299                 ],
1300                 "indexes" => [
1301                         "PRIMARY" => ["id"],
1302                         "uid" => ["uid"],
1303                         "cid" => ["cid"],
1304                 ]
1305         ],
1306         "profile_field" => [
1307                 "comment" => "Custom profile fields",
1308                 "fields" => [
1309                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1310                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "Owner user id"],
1311                         "order" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "1", "comment" => "Field ordering per user"],
1312                         "psid" => ["type" => "int unsigned", "foreign" => ["permissionset" => "id", "on delete" => "restrict"], "comment" => "ID of the permission set of this profile field - 0 = public"],
1313                         "label" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Label of the field"],
1314                         "value" => ["type" => "text", "comment" => "Value of the field"],
1315                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "creation time"],
1316                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "last edit time"],
1317                 ],
1318                 "indexes" => [
1319                         "PRIMARY" => ["id"],
1320                         "uid" => ["uid"],
1321                         "order" => ["order"],
1322                         "psid" => ["psid"],
1323                 ]
1324         ],
1325         "push_subscriber" => [
1326                 "comment" => "Used for OStatus: Contains feed subscribers",
1327                 "fields" => [
1328                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1329                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1330                         "callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1331                         "topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1332                         "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1333                         "push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1334                         "last_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last successful trial"],
1335                         "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1336                         "renewed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last subscription renewal"],
1337                         "secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1338                 ],
1339                 "indexes" => [
1340                         "PRIMARY" => ["id"],
1341                         "next_try" => ["next_try"],
1342                         "uid" => ["uid"]
1343                 ]
1344         ],
1345         "register" => [
1346                 "comment" => "registrations requiring admin approval",
1347                 "fields" => [
1348                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1349                         "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1350                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1351                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1352                         "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1353                         "language" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1354                         "note" => ["type" => "text", "comment" => ""],
1355                 ],
1356                 "indexes" => [
1357                         "PRIMARY" => ["id"],
1358                         "uid" => ["uid"],
1359                 ]
1360         ],
1361         "search" => [
1362                 "comment" => "",
1363                 "fields" => [
1364                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1365                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1366                         "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1367                 ],
1368                 "indexes" => [
1369                         "PRIMARY" => ["id"],
1370                         "uid" => ["uid"],
1371                 ]
1372         ],
1373         "session" => [
1374                 "comment" => "web session storage",
1375                 "fields" => [
1376                         "id" => ["type" => "bigint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1377                         "sid" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1378                         "data" => ["type" => "text", "comment" => ""],
1379                         "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1380                 ],
1381                 "indexes" => [
1382                         "PRIMARY" => ["id"],
1383                         "sid" => ["sid(64)"],
1384                         "expire" => ["expire"],
1385                 ]
1386         ],
1387         "storage" => [
1388                 "comment" => "Data stored by Database storage backend",
1389                 "fields" => [
1390                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented image data id"],
1391                         "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"]
1392                 ],
1393                 "indexes" => [
1394                         "PRIMARY" => ["id"]
1395                 ]
1396         ],
1397         "thread" => [
1398                 "comment" => "Thread related data",
1399                 "fields" => [
1400                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"],
1401                                 "comment" => "sequential ID"],
1402                         "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the item uri"],
1403                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1404                         "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
1405                         "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Item owner"],
1406                         "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id", "on delete" => "restrict"], "comment" => "Item author"],
1407                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1408                         "edited" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1409                         "commented" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1410                         "received" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1411                         "changed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
1412                         "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1413                         "private" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "0=public, 1=private, 2=unlisted"],
1414                         "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1415                         "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1416                         "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1417                         "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1418                         "ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1419                         "post-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Post type (personal note, bookmark, ...)"],
1420                         "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1421                         "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1422                         "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1423                         "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1424                         "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1425                         "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
1426                         "bookmark" => ["type" => "boolean", "comment" => ""],
1427                 ],
1428                 "indexes" => [
1429                         "PRIMARY" => ["iid"],
1430                         "uid_network_commented" => ["uid", "network", "commented"],
1431                         "uid_network_received" => ["uid", "network", "received"],
1432                         "uid_contactid_commented" => ["uid", "contact-id", "commented"],
1433                         "uid_contactid_received" => ["uid", "contact-id", "received"],
1434                         "contactid" => ["contact-id"],
1435                         "ownerid" => ["owner-id"],
1436                         "authorid" => ["author-id"],
1437                         "uid_received" => ["uid", "received"],
1438                         "uid_commented" => ["uid", "commented"],
1439                         "uid_wall_received" => ["uid", "wall", "received"],
1440                         "private_wall_origin_commented" => ["private", "wall", "origin", "commented"],
1441                         "uri-id" => ["uri-id"],
1442                 ]
1443         ],
1444         "tokens" => [
1445                 "comment" => "OAuth usage",
1446                 "fields" => [
1447                         "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
1448                         "secret" => ["type" => "text", "comment" => ""],
1449                         "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "foreign" => ["clients" => "client_id"]],
1450                         "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1451                         "scope" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
1452                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
1453                 ],
1454                 "indexes" => [
1455                         "PRIMARY" => ["id"],
1456                         "client_id" => ["client_id"],
1457                         "uid" => ["uid"]
1458                 ]
1459         ],
1460         "userd" => [
1461                 "comment" => "Deleted usernames",
1462                 "fields" => [
1463                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1464                         "username" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
1465                 ],
1466                 "indexes" => [
1467                         "PRIMARY" => ["id"],
1468                         "username" => ["username(32)"],
1469                 ]
1470         ],
1471         "user-contact" => [
1472                 "comment" => "User specific public contact data",
1473                 "fields" => [
1474                         "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["contact" => "id"], "comment" => "Contact id of the linked public contact"],
1475                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1476                         "blocked" => ["type" => "boolean", "comment" => "Contact is completely blocked for this user"],
1477                         "ignored" => ["type" => "boolean", "comment" => "Posts from this contact are ignored"],
1478                         "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"]
1479                 ],
1480                 "indexes" => [
1481                         "PRIMARY" => ["uid", "cid"],
1482                         "cid" => ["cid"],
1483                 ]
1484         ],
1485         "user-item" => [
1486                 "comment" => "User specific item data",
1487                 "fields" => [
1488                         "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["item" => "id"], "comment" => "Item id"],
1489                         "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "foreign" => ["user" => "uid"], "comment" => "User id"],
1490                         "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
1491                         "ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
1492                         "pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"],
1493                         "notification-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1494                 ],
1495                 "indexes" => [
1496                         "PRIMARY" => ["uid", "iid"],
1497                         "uid_pinned" => ["uid", "pinned"],
1498                         "iid_uid" => ["iid", "uid"]
1499                 ]
1500         ],
1501         "worker-ipc" => [
1502                 "comment" => "Inter process communication between the frontend and the worker",
1503                 "fields" => [
1504                         "key" => ["type" => "int", "not null" => "1", "primary" => "1", "comment" => ""],
1505                         "jobs" => ["type" => "boolean", "comment" => "Flag for outstanding jobs"],
1506                 ],
1507                 "indexes" => [
1508                         "PRIMARY" => ["key"],
1509                 ],
1510                 "engine" => "MEMORY",
1511         ],
1512         "workerqueue" => [
1513                 "comment" => "Background tasks queue entries",
1514                 "fields" => [
1515                         "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
1516                         "command" => ["type" => "varchar(100)", "comment" => "Task command"],
1517                         "parameter" => ["type" => "mediumtext", "comment" => "Task parameter"],
1518                         "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"],
1519                         "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Creation date"],
1520                         "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
1521                         "executed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Execution date"],
1522                         "next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
1523                         "retrial" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1524                         "done" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marked 1 when the task was done - will be deleted later"],
1525                 ],
1526                 "indexes" => [
1527                         "PRIMARY" => ["id"],
1528                         "command" => ["command"],
1529                         "done_command_parameter" => ["done", "command", "parameter(64)"],
1530                         "done_executed" => ["done", "executed"],
1531                         "done_priority_retrial_created" => ["done", "priority", "retrial", "created"],
1532                         "done_priority_next_try" => ["done", "priority", "next_try"],
1533                         "done_pid_next_try" => ["done", "pid", "next_try"],
1534                         "done_pid_retrial" => ["done", "pid", "retrial"],
1535                         "done_pid_priority_created" => ["done", "pid", "priority", "created"]
1536                 ]
1537         ],
1538 ];