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