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