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