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