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