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