]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
Remove event.adjust field
[friendica.git] / static / dbview.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2021, the Friendica project
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 view structure configuration file.
21  *
22  * Here are described all the view Friendica needs to work.
23  *
24  * Syntax (braces indicate optionale values):
25  * "<view name>" => [
26  *      "fields" => [
27  *              "<field name>" => ["table", "field"],
28  *              "<field name>" => "SQL expression",
29  *              ...
30  *      ],
31  *      "query" => "FROM `table` INNER JOIN `other-table` ..."
32  *      ],
33  * ],
34  *
35  * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
36  *
37  */
38
39  return [
40         "application-view" => [
41                 "fields" => [
42                         "id" => ["application", "id"],
43                         "uid" => ["application-token", "uid"],
44                         "name" => ["application", "name"],
45                         "redirect_uri" => ["application", "redirect_uri"],
46                         "website" => ["application", "website"],
47                         "client_id" => ["application", "client_id"],
48                         "client_secret" => ["application", "client_secret"],
49                         "code" => ["application-token", "code"],
50                         "access_token" => ["application-token", "access_token"],
51                         "created_at" => ["application-token", "created_at"],
52                         "scopes" => ["application-token", "scopes"],
53                         "read" => ["application-token", "read"],
54                         "write" => ["application-token", "write"],
55                         "follow" => ["application-token", "follow"],
56                         "push" => ["application-token", "push"],
57                 ],
58                 "query" => "FROM `application-token`
59                         INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`"
60         ],
61         "post-user-view" => [
62                 "fields" => [
63                         "id" => ["post-user", "id"],
64                         "post-user-id" => ["post-user", "id"],
65                         "uid" => ["post-user", "uid"],
66                         "parent" => ["parent-post", "id"],
67                         "uri" => ["item-uri", "uri"],
68                         "uri-id" => ["post-user", "uri-id"],
69                         "parent-uri" => ["parent-item-uri", "uri"],
70                         "parent-uri-id" => ["post-user", "parent-uri-id"],
71                         "thr-parent" => ["thr-parent-item-uri", "uri"],
72                         "thr-parent-id" => ["post-user", "thr-parent-id"],
73                         "guid" => ["item-uri", "guid"],
74                         "wall" => ["post-user", "wall"],
75                         "gravity" => ["post-user", "gravity"],
76                         "extid" => ["external-item-uri", "uri"],
77                         "external-id" => ["post-user", "external-id"],
78                         "created" => ["post-user", "created"],
79                         "edited" => ["post-user", "edited"],
80                         "commented" => ["post-thread-user", "commented"],
81                         "received" => ["post-user", "received"],
82                         "changed" => ["post-thread-user", "changed"],
83                         "post-type" => ["post-user", "post-type"],
84                         "post-reason" => ["post-user", "post-reason"],
85                         "private" => ["post-user", "private"],
86                         "pubmail" => ["post-thread-user", "pubmail"],
87                         "visible" => ["post-user", "visible"],
88                         "starred" => ["post-thread-user", "starred"],
89                         "pinned" => ["post-thread-user", "pinned"],
90                         "unseen" => ["post-user", "unseen"],
91                         "deleted" => ["post-user", "deleted"],
92                         "origin" => ["post-user", "origin"],
93                         "parent-origin" => ["post-thread-user", "origin"],
94                         "forum_mode" => ["post-thread-user", "forum_mode"],
95                         "mention" => ["post-thread-user", "mention"],
96                         "global" => ["post-user", "global"],
97                         "network" => ["post-user", "network"],
98                         "vid" => ["post-user", "vid"],
99                         "psid" => ["post-user", "psid"],
100                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
101                         "title" => ["post-content", "title"],
102                         "content-warning" => ["post-content", "content-warning"],
103                         "raw-body" => ["post-content", "raw-body"],
104                         "body" => ["post-content", "body"],
105                         "rendered-hash" => ["post-content", "rendered-hash"],
106                         "rendered-html" => ["post-content", "rendered-html"],
107                         "language" => ["post-content", "language"],
108                         "plink" => ["post-content", "plink"],
109                         "location" => ["post-content", "location"],
110                         "coord" => ["post-content", "coord"],
111                         "app" => ["post-content", "app"],
112                         "object-type" => ["post-content", "object-type"],
113                         "object" => ["post-content", "object"],
114                         "target-type" => ["post-content", "target-type"],
115                         "target" => ["post-content", "target"],
116                         "resource-id" => ["post-content", "resource-id"],
117                         "contact-id" => ["post-user", "contact-id"],
118                         "contact-link" => ["contact", "url"],
119                         "contact-addr" => ["contact", "addr"],
120                         "contact-name" => ["contact", "name"],
121                         "contact-nick" => ["contact", "nick"],
122                         "contact-avatar" => ["contact", "thumb"],
123                         "contact-network" => ["contact", "network"],
124                         "contact-blocked" => ["contact", "blocked"],
125                         "contact-hidden" => ["contact", "hidden"],
126                         "contact-readonly" => ["contact", "readonly"],
127                         "contact-archive" => ["contact", "archive"],
128                         "contact-pending" => ["contact", "pending"],
129                         "contact-rel" => ["contact", "rel"],
130                         "contact-uid" => ["contact", "uid"],
131                         "contact-contact-type" => ["contact", "contact-type"],
132                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
133                         "self" => ["contact", "self"],
134                         "cid" => ["contact", "id"],
135                         "alias" => ["contact", "alias"],
136                         "photo" => ["contact", "photo"],
137                         "name-date" => ["contact", "name-date"],
138                         "uri-date" => ["contact", "uri-date"],
139                         "avatar-date" => ["contact", "avatar-date"],
140                         "thumb" => ["contact", "thumb"],
141                         "author-id" => ["post-user", "author-id"],
142                         "author-link" => ["author", "url"],
143                         "author-addr" => ["author", "addr"],
144                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
145                         "author-nick" => ["author", "nick"],
146                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
147                         "author-network" => ["author", "network"],
148                         "author-blocked" => ["author", "blocked"],
149                         "author-hidden" => ["author", "hidden"],
150                         "owner-id" => ["post-user", "owner-id"],
151                         "owner-link" => ["owner", "url"],
152                         "owner-addr" => ["owner", "addr"],
153                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
154                         "owner-nick" => ["owner", "nick"],
155                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
156                         "owner-network" => ["owner", "network"],
157                         "owner-blocked" => ["owner", "blocked"],
158                         "owner-hidden" => ["owner", "hidden"],
159                         "owner-contact-type" => ["owner", "contact-type"],
160                         "causer-id" => ["post-user", "causer-id"],
161                         "causer-link" => ["causer", "url"],
162                         "causer-addr" => ["causer", "addr"],
163                         "causer-name" => ["causer", "name"],
164                         "causer-nick" => ["causer", "nick"],
165                         "causer-avatar" => ["causer", "thumb"],
166                         "causer-network" => ["causer", "network"],
167                         "causer-blocked" => ["causer", "blocked"],
168                         "causer-hidden" => ["causer", "hidden"],
169                         "causer-contact-type" => ["causer", "contact-type"],
170                         "postopts" => ["post-delivery-data", "postopts"],
171                         "inform" => ["post-delivery-data", "inform"],
172                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
173                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
174                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
175                         "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
176                         "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
177                         "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
178                         "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
179                         "event-id" => ["post-user", "event-id"],
180                         "event-created" => ["event", "created"],
181                         "event-edited" => ["event", "edited"],
182                         "event-start" => ["event", "start"],
183                         "event-finish" => ["event", "finish"],
184                         "event-summary" => ["event", "summary"],
185                         "event-desc" => ["event", "desc"],
186                         "event-location" => ["event", "location"],
187                         "event-type" => ["event", "type"],
188                         "event-nofinish" => ["event", "nofinish"],
189                         "event-ignore" => ["event", "ignore"],
190                         "signed_text" => ["diaspora-interaction", "interaction"],
191                         "parent-guid" => ["parent-item-uri", "guid"],
192                         "parent-network" => ["parent-post", "network"],
193                         "parent-author-id" => ["parent-post", "author-id"],
194                         "parent-author-link" => ["parent-post-author", "url"],
195                         "parent-author-name" => ["parent-post-author", "name"],
196                         "parent-author-network" => ["parent-post-author", "network"],
197                         "parent-author-blocked" => ["parent-post-author", "blocked"],
198                         "parent-author-hidden" => ["parent-post-author", "hidden"],
199                 ],
200                 "query" => "FROM `post-user`
201                         STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
202                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
203                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
204                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
205                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
206                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
207                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
208                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
209                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
210                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
211                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
212                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
213                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
214                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
215                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
216                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
217                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
218         ],
219         "post-thread-user-view" => [
220                 "fields" => [
221                         "id" => ["post-user", "id"],
222                         "post-user-id" => ["post-user", "id"],
223                         "uid" => ["post-thread-user", "uid"],
224                         "parent" => ["parent-post", "id"],
225                         "uri" => ["item-uri", "uri"],
226                         "uri-id" => ["post-thread-user", "uri-id"],
227                         "parent-uri" => ["parent-item-uri", "uri"],
228                         "parent-uri-id" => ["post-user", "parent-uri-id"],
229                         "thr-parent" => ["thr-parent-item-uri", "uri"],
230                         "thr-parent-id" => ["post-user", "thr-parent-id"],
231                         "guid" => ["item-uri", "guid"],
232                         "wall" => ["post-thread-user", "wall"],
233                         "gravity" => ["post-user", "gravity"],
234                         "extid" => ["external-item-uri", "uri"],
235                         "external-id" => ["post-user", "external-id"],
236                         "created" => ["post-thread-user", "created"],
237                         "edited" => ["post-user", "edited"],
238                         "commented" => ["post-thread-user", "commented"],
239                         "received" => ["post-thread-user", "received"],
240                         "changed" => ["post-thread-user", "changed"],
241                         "post-type" => ["post-user", "post-type"],
242                         "post-reason" => ["post-user", "post-reason"],
243                         "private" => ["post-user", "private"],
244                         "pubmail" => ["post-thread-user", "pubmail"],
245                         "ignored" => ["post-thread-user", "ignored"],
246                         "visible" => ["post-user", "visible"],
247                         "starred" => ["post-thread-user", "starred"],
248                         "pinned" => ["post-thread-user", "pinned"],
249                         "unseen" => ["post-thread-user", "unseen"],
250                         "deleted" => ["post-user", "deleted"],
251                         "origin" => ["post-thread-user", "origin"],
252                         "forum_mode" => ["post-thread-user", "forum_mode"],
253                         "mention" => ["post-thread-user", "mention"],
254                         "global" => ["post-user", "global"],
255                         "network" => ["post-thread-user", "network"],
256                         "vid" => ["post-user", "vid"],
257                         "psid" => ["post-thread-user", "psid"],
258                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
259                         "title" => ["post-content", "title"],
260                         "content-warning" => ["post-content", "content-warning"],
261                         "raw-body" => ["post-content", "raw-body"],
262                         "body" => ["post-content", "body"],
263                         "rendered-hash" => ["post-content", "rendered-hash"],
264                         "rendered-html" => ["post-content", "rendered-html"],
265                         "language" => ["post-content", "language"],
266                         "plink" => ["post-content", "plink"],
267                         "location" => ["post-content", "location"],
268                         "coord" => ["post-content", "coord"],
269                         "app" => ["post-content", "app"],
270                         "object-type" => ["post-content", "object-type"],
271                         "object" => ["post-content", "object"],
272                         "target-type" => ["post-content", "target-type"],
273                         "target" => ["post-content", "target"],
274                         "resource-id" => ["post-content", "resource-id"],
275                         "contact-id" => ["post-thread-user", "contact-id"],
276                         "contact-link" => ["contact", "url"],
277                         "contact-addr" => ["contact", "addr"],
278                         "contact-name" => ["contact", "name"],
279                         "contact-nick" => ["contact", "nick"],
280                         "contact-avatar" => ["contact", "thumb"],
281                         "contact-network" => ["contact", "network"],
282                         "contact-blocked" => ["contact", "blocked"],
283                         "contact-hidden" => ["contact", "hidden"],
284                         "contact-readonly" => ["contact", "readonly"],
285                         "contact-archive" => ["contact", "archive"],
286                         "contact-pending" => ["contact", "pending"],
287                         "contact-rel" => ["contact", "rel"],
288                         "contact-uid" => ["contact", "uid"],
289                         "contact-contact-type" => ["contact", "contact-type"],
290                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
291                         "self" => ["contact", "self"],
292                         "cid" => ["contact", "id"],
293                         "alias" => ["contact", "alias"],
294                         "photo" => ["contact", "photo"],
295                         "name-date" => ["contact", "name-date"],
296                         "uri-date" => ["contact", "uri-date"],
297                         "avatar-date" => ["contact", "avatar-date"],
298                         "thumb" => ["contact", "thumb"],
299                         "author-id" => ["post-thread-user", "author-id"],
300                         "author-link" => ["author", "url"],
301                         "author-addr" => ["author", "addr"],
302                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
303                         "author-nick" => ["author", "nick"],
304                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
305                         "author-network" => ["author", "network"],
306                         "author-blocked" => ["author", "blocked"],
307                         "author-hidden" => ["author", "hidden"],
308                         "owner-id" => ["post-thread-user", "owner-id"],
309                         "owner-link" => ["owner", "url"],
310                         "owner-addr" => ["owner", "addr"],
311                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
312                         "owner-nick" => ["owner", "nick"],
313                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
314                         "owner-network" => ["owner", "network"],
315                         "owner-blocked" => ["owner", "blocked"],
316                         "owner-hidden" => ["owner", "hidden"],
317                         "owner-contact-type" => ["owner", "contact-type"],
318                         "causer-id" => ["post-thread-user", "causer-id"],
319                         "causer-link" => ["causer", "url"],
320                         "causer-addr" => ["causer", "addr"],
321                         "causer-name" => ["causer", "name"],
322                         "causer-nick" => ["causer", "nick"],
323                         "causer-avatar" => ["causer", "thumb"],
324                         "causer-network" => ["causer", "network"],
325                         "causer-blocked" => ["causer", "blocked"],
326                         "causer-hidden" => ["causer", "hidden"],
327                         "causer-contact-type" => ["causer", "contact-type"],
328                         "postopts" => ["post-delivery-data", "postopts"],
329                         "inform" => ["post-delivery-data", "inform"],
330                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
331                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
332                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
333                         "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
334                         "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
335                         "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
336                         "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
337                         "event-id" => ["post-user", "event-id"],
338                         "event-created" => ["event", "created"],
339                         "event-edited" => ["event", "edited"],
340                         "event-start" => ["event", "start"],
341                         "event-finish" => ["event", "finish"],
342                         "event-summary" => ["event", "summary"],
343                         "event-desc" => ["event", "desc"],
344                         "event-location" => ["event", "location"],
345                         "event-type" => ["event", "type"],
346                         "event-nofinish" => ["event", "nofinish"],
347                         "event-ignore" => ["event", "ignore"],
348                         "signed_text" => ["diaspora-interaction", "interaction"],
349                         "parent-guid" => ["parent-item-uri", "guid"],
350                         "parent-network" => ["parent-post", "network"],
351                         "parent-author-id" => ["parent-post", "author-id"],
352                         "parent-author-link" => ["parent-post-author", "url"],
353                         "parent-author-name" => ["parent-post-author", "name"],
354                         "parent-author-network" => ["parent-post-author", "network"],
355                         "parent-author-blocked" => ["parent-post-author", "blocked"],
356                         "parent-author-hidden" => ["parent-post-author", "hidden"],
357                 ],
358                 "query" => "FROM `post-thread-user`
359                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
360                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
361                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
362                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
363                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
364                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
365                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
366                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
367                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
368                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
369                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
370                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
371                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
372                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
373                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
374                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-thread-user`.`uid`
375                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
376         ],
377         "post-view" => [
378                 "fields" => [
379                         "uri" => ["item-uri", "uri"],
380                         "uri-id" => ["post", "uri-id"],
381                         "parent-uri" => ["parent-item-uri", "uri"],
382                         "parent-uri-id" => ["post", "parent-uri-id"],
383                         "thr-parent" => ["thr-parent-item-uri", "uri"],
384                         "thr-parent-id" => ["post", "thr-parent-id"],
385                         "guid" => ["item-uri", "guid"],
386                         "gravity" => ["post", "gravity"],
387                         "extid" => ["external-item-uri", "uri"],
388                         "external-id" => ["post", "external-id"],
389                         "created" => ["post", "created"],
390                         "edited" => ["post", "edited"],
391                         "commented" => ["post-thread", "commented"],
392                         "received" => ["post", "received"],
393                         "changed" => ["post-thread", "changed"],
394                         "post-type" => ["post", "post-type"],
395                         "private" => ["post", "private"],
396                         "visible" => ["post", "visible"],
397                         "deleted" => ["post", "deleted"],
398                         "global" => ["post", "global"],
399                         "network" => ["post", "network"],
400                         "vid" => ["post", "vid"],
401                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
402                         "title" => ["post-content", "title"],
403                         "content-warning" => ["post-content", "content-warning"],
404                         "raw-body" => ["post-content", "raw-body"],
405                         "body" => ["post-content", "body"],
406                         "rendered-hash" => ["post-content", "rendered-hash"],
407                         "rendered-html" => ["post-content", "rendered-html"],
408                         "language" => ["post-content", "language"],
409                         "plink" => ["post-content", "plink"],
410                         "location" => ["post-content", "location"],
411                         "coord" => ["post-content", "coord"],
412                         "app" => ["post-content", "app"],
413                         "object-type" => ["post-content", "object-type"],
414                         "object" => ["post-content", "object"],
415                         "target-type" => ["post-content", "target-type"],
416                         "target" => ["post-content", "target"],
417                         "resource-id" => ["post-content", "resource-id"],
418                         "contact-id" => ["post", "author-id"],
419                         "contact-link" => ["author", "url"],
420                         "contact-addr" => ["author", "addr"],
421                         "contact-name" => ["author", "name"],
422                         "contact-nick" => ["author", "nick"],
423                         "contact-avatar" => ["author", "thumb"],
424                         "contact-network" => ["author", "network"],
425                         "contact-blocked" => ["author", "blocked"],
426                         "contact-hidden" => ["author", "hidden"],
427                         "contact-readonly" => ["author", "readonly"],
428                         "contact-archive" => ["author", "archive"],
429                         "contact-pending" => ["author", "pending"],
430                         "contact-rel" => ["author", "rel"],
431                         "contact-uid" => ["author", "uid"],
432                         "contact-contact-type" => ["author", "contact-type"],
433                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
434                         "self" => "false",
435                         "cid" => ["author", "id"],
436                         "alias" => ["author", "alias"],
437                         "photo" => ["author", "photo"],
438                         "name-date" => ["author", "name-date"],
439                         "uri-date" => ["author", "uri-date"],
440                         "avatar-date" => ["author", "avatar-date"],
441                         "thumb" => ["author", "thumb"],
442                         "author-id" => ["post", "author-id"],
443                         "author-link" => ["author", "url"],
444                         "author-addr" => ["author", "addr"],
445                         "author-name" => ["author", "name"],
446                         "author-nick" => ["author", "nick"],
447                         "author-avatar" => ["author", "thumb"],
448                         "author-network" => ["author", "network"],
449                         "author-blocked" => ["author", "blocked"],
450                         "author-hidden" => ["author", "hidden"],
451                         "owner-id" => ["post", "owner-id"],
452                         "owner-link" => ["owner", "url"],
453                         "owner-addr" => ["owner", "addr"],
454                         "owner-name" => ["owner", "name"],
455                         "owner-nick" => ["owner", "nick"],
456                         "owner-avatar" => ["owner", "thumb"],
457                         "owner-network" => ["owner", "network"],
458                         "owner-blocked" => ["owner", "blocked"],
459                         "owner-hidden" => ["owner", "hidden"],
460                         "owner-contact-type" => ["owner", "contact-type"],
461                         "causer-id" => ["post", "causer-id"],
462                         "causer-link" => ["causer", "url"],
463                         "causer-addr" => ["causer", "addr"],
464                         "causer-name" => ["causer", "name"],
465                         "causer-nick" => ["causer", "nick"],
466                         "causer-avatar" => ["causer", "thumb"],
467                         "causer-network" => ["causer", "network"],
468                         "causer-blocked" => ["causer", "blocked"],
469                         "causer-hidden" => ["causer", "hidden"],
470                         "causer-contact-type" => ["causer", "contact-type"],
471                         "signed_text" => ["diaspora-interaction", "interaction"],
472                         "parent-guid" => ["parent-item-uri", "guid"],
473                         "parent-network" => ["parent-post", "network"],
474                         "parent-author-id" => ["parent-post", "author-id"],
475                         "parent-author-link" => ["parent-post-author", "url"],
476                         "parent-author-name" => ["parent-post-author", "name"],
477                         "parent-author-network" => ["parent-post-author", "network"],
478                         "parent-author-blocked" => ["parent-post-author", "blocked"],
479                         "parent-author-hidden" => ["parent-post-author", "hidden"],
480                 ],
481                 "query" => "FROM `post`
482                         STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
483                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
484                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
485                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
486                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
487                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
488                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
489                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
490                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
491                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
492                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
493                         LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
494                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
495         ],
496         "post-thread-view" => [
497                 "fields" => [
498                         "uri" => ["item-uri", "uri"],
499                         "uri-id" => ["post-thread", "uri-id"],
500                         "parent-uri" => ["parent-item-uri", "uri"],
501                         "parent-uri-id" => ["post", "parent-uri-id"],
502                         "thr-parent" => ["thr-parent-item-uri", "uri"],
503                         "thr-parent-id" => ["post", "thr-parent-id"],
504                         "guid" => ["item-uri", "guid"],
505                         "gravity" => ["post", "gravity"],
506                         "extid" => ["external-item-uri", "uri"],
507                         "external-id" => ["post", "external-id"],
508                         "created" => ["post-thread", "created"],
509                         "edited" => ["post", "edited"],
510                         "commented" => ["post-thread", "commented"],
511                         "received" => ["post-thread", "received"],
512                         "changed" => ["post-thread", "changed"],
513                         "post-type" => ["post", "post-type"],
514                         "private" => ["post", "private"],
515                         "visible" => ["post", "visible"],
516                         "deleted" => ["post", "deleted"],
517                         "global" => ["post", "global"],
518                         "network" => ["post-thread", "network"],
519                         "vid" => ["post", "vid"],
520                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
521                         "title" => ["post-content", "title"],
522                         "content-warning" => ["post-content", "content-warning"],
523                         "raw-body" => ["post-content", "raw-body"],
524                         "body" => ["post-content", "body"],
525                         "rendered-hash" => ["post-content", "rendered-hash"],
526                         "rendered-html" => ["post-content", "rendered-html"],
527                         "language" => ["post-content", "language"],
528                         "plink" => ["post-content", "plink"],
529                         "location" => ["post-content", "location"],
530                         "coord" => ["post-content", "coord"],
531                         "app" => ["post-content", "app"],
532                         "object-type" => ["post-content", "object-type"],
533                         "object" => ["post-content", "object"],
534                         "target-type" => ["post-content", "target-type"],
535                         "target" => ["post-content", "target"],
536                         "resource-id" => ["post-content", "resource-id"],
537                         "contact-id" => ["post-thread", "author-id"],
538                         "contact-link" => ["author", "url"],
539                         "contact-addr" => ["author", "addr"],
540                         "contact-name" => ["author", "name"],
541                         "contact-nick" => ["author", "nick"],
542                         "contact-avatar" => ["author", "thumb"],
543                         "contact-network" => ["author", "network"],
544                         "contact-blocked" => ["author", "blocked"],
545                         "contact-hidden" => ["author", "hidden"],
546                         "contact-readonly" => ["author", "readonly"],
547                         "contact-archive" => ["author", "archive"],
548                         "contact-pending" => ["author", "pending"],
549                         "contact-rel" => ["author", "rel"],
550                         "contact-uid" => ["author", "uid"],
551                         "contact-contact-type" => ["author", "contact-type"],
552                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
553                         "self" => "false",
554                         "cid" => ["author", "id"],
555                         "alias" => ["author", "alias"],
556                         "photo" => ["author", "photo"],
557                         "name-date" => ["author", "name-date"],
558                         "uri-date" => ["author", "uri-date"],
559                         "avatar-date" => ["author", "avatar-date"],
560                         "thumb" => ["author", "thumb"],
561                         "author-id" => ["post-thread", "author-id"],
562                         "author-link" => ["author", "url"],
563                         "author-addr" => ["author", "addr"],
564                         "author-name" => ["author", "name"],
565                         "author-nick" => ["author", "nick"],
566                         "author-avatar" => ["author", "thumb"],
567                         "author-network" => ["author", "network"],
568                         "author-blocked" => ["author", "blocked"],
569                         "author-hidden" => ["author", "hidden"],
570                         "owner-id" => ["post-thread", "owner-id"],
571                         "owner-link" => ["owner", "url"],
572                         "owner-addr" => ["owner", "addr"],
573                         "owner-name" => ["owner", "name"],
574                         "owner-nick" => ["owner", "nick"],
575                         "owner-avatar" => ["owner", "thumb"],
576                         "owner-network" => ["owner", "network"],
577                         "owner-blocked" => ["owner", "blocked"],
578                         "owner-hidden" => ["owner", "hidden"],
579                         "owner-contact-type" => ["owner", "contact-type"],
580                         "causer-id" => ["post-thread", "causer-id"],
581                         "causer-link" => ["causer", "url"],
582                         "causer-addr" => ["causer", "addr"],
583                         "causer-name" => ["causer", "name"],
584                         "causer-nick" => ["causer", "nick"],
585                         "causer-avatar" => ["causer", "thumb"],
586                         "causer-network" => ["causer", "network"],
587                         "causer-blocked" => ["causer", "blocked"],
588                         "causer-hidden" => ["causer", "hidden"],
589                         "causer-contact-type" => ["causer", "contact-type"],
590                         "signed_text" => ["diaspora-interaction", "interaction"],
591                         "parent-guid" => ["parent-item-uri", "guid"],
592                         "parent-network" => ["parent-post", "network"],
593                         "parent-author-id" => ["parent-post", "author-id"],
594                         "parent-author-link" => ["parent-post-author", "url"],
595                         "parent-author-name" => ["parent-post-author", "name"],
596                         "parent-author-network" => ["parent-post-author", "network"],
597                         "parent-author-blocked" => ["parent-post-author", "blocked"],
598                         "parent-author-hidden" => ["parent-post-author", "hidden"],
599                 ],
600                 "query" => "FROM `post-thread`
601                         INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
602                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
603                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
604                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
605                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
606                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
607                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
608                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
609                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
610                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
611                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
612                         LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
613                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
614         ],
615         "category-view" => [
616                 "fields" => [
617                         "uri-id" => ["post-category", "uri-id"],
618                         "uid" => ["post-category", "uid"],
619                         "type" => ["post-category", "type"],
620                         "tid" => ["post-category", "tid"],
621                         "name" => ["tag", "name"],
622                         "url" => ["tag", "url"],
623                 ],
624                 "query" => "FROM `post-category`
625                         LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
626         ],
627         "tag-view" => [
628                 "fields" => [
629                         "uri-id" => ["post-tag", "uri-id"],
630                         "type" => ["post-tag", "type"],
631                         "tid" => ["post-tag", "tid"],
632                         "cid" => ["post-tag", "cid"],
633                         "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
634                         "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
635                 ],
636                 "query" => "FROM `post-tag`
637                         LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
638                         LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
639         ],
640         "network-item-view" => [
641                 "fields" => [
642                         "uri-id" => ["post-user", "uri-id"],
643                         "parent" => ["parent-post", "id"],
644                         "received" => ["post-user", "received"],
645                         "commented" => ["post-thread-user", "commented"],
646                         "created" => ["post-user", "created"],
647                         "uid" => ["post-user", "uid"],
648                         "starred" => ["post-thread-user", "starred"],
649                         "mention" => ["post-thread-user", "mention"],
650                         "network" => ["post-user", "network"],
651                         "unseen" => ["post-user", "unseen"],
652                         "gravity" => ["post-user", "gravity"],
653                         "contact-id" => ["post-user", "contact-id"],
654                         "contact-type" => ["ownercontact", "contact-type"],
655                 ],
656                 "query" => "FROM `post-user`
657                         STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`                  
658                         INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
659                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
660                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
661                         INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
662                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
663                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
664                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
665                         AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
666                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
667                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
668         ],
669         "network-thread-view" => [
670                 "fields" => [
671                         "uri-id" => ["post-thread-user", "uri-id"],
672                         "parent" => ["parent-post", "id"],
673                         "received" => ["post-thread-user", "received"],
674                         "commented" => ["post-thread-user", "commented"],
675                         "created" => ["post-thread-user", "created"],
676                         "uid" => ["post-thread-user", "uid"],
677                         "starred" => ["post-thread-user", "starred"],
678                         "mention" => ["post-thread-user", "mention"],
679                         "network" => ["post-thread-user", "network"],
680                         "contact-id" => ["post-thread-user", "contact-id"],
681                         "contact-type" => ["ownercontact", "contact-type"],
682                 ],
683                 "query" => "FROM `post-thread-user`
684                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
685                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
686                         LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
687                         LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
688                         LEFT JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
689                         LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
690                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
691                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
692                         AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
693                         AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
694                         AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
695         ],
696         "owner-view" => [
697                 "fields" => [
698                         "id" => ["contact", "id"],
699                         "uid" => ["contact", "uid"],
700                         "created" => ["contact", "created"],
701                         "updated" => ["contact", "updated"],
702                         "self" => ["contact", "self"],
703                         "remote_self" => ["contact", "remote_self"],
704                         "rel" => ["contact", "rel"],
705                         "network" => ["contact", "network"],
706                         "protocol" => ["contact", "protocol"],
707                         "name" => ["contact", "name"],
708                         "nick" => ["contact", "nick"],
709                         "location" => ["contact", "location"],
710                         "about" => ["contact", "about"],
711                         "keywords" => ["contact", "keywords"],
712                         "xmpp" => ["contact", "xmpp"],
713                         "matrix" => ["contact", "matrix"],
714                         "attag" => ["contact", "attag"],
715                         "avatar" => ["contact", "avatar"],
716                         "photo" => ["contact", "photo"],
717                         "thumb" => ["contact", "thumb"],
718                         "micro" => ["contact", "micro"],
719                         "header" => ["contact", "header"],
720                         "url" => ["contact", "url"],
721                         "nurl" => ["contact", "nurl"],
722                         "uri-id" => ["contact", "uri-id"],
723                         "addr" => ["contact", "addr"],
724                         "alias" => ["contact", "alias"],
725                         "pubkey" => ["contact", "pubkey"],
726                         "prvkey" => ["contact", "prvkey"],
727                         "batch" => ["contact", "batch"],
728                         "request" => ["contact", "request"],
729                         "notify" => ["contact", "notify"],
730                         "poll" => ["contact", "poll"],
731                         "confirm" => ["contact", "confirm"],
732                         "poco" => ["contact", "poco"],
733                         "subhub" => ["contact", "subhub"],
734                         "hub-verify" => ["contact", "hub-verify"],
735                         "last-update" => ["contact", "last-update"],
736                         "success_update" => ["contact", "success_update"],
737                         "failure_update" => ["contact", "failure_update"],
738                         "name-date" => ["contact", "name-date"],
739                         "uri-date" => ["contact", "uri-date"],
740                         "avatar-date" => ["contact", "avatar-date"],
741                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
742                         "term-date" => ["contact", "term-date"],
743                         "last-item" => ["contact", "last-item"],
744                         "priority" => ["contact", "priority"],
745                         "blocked" => ["user", "blocked"],
746                         "block_reason" => ["contact", "block_reason"],
747                         "readonly" => ["contact", "readonly"],
748                         "writable" => ["contact", "writable"],
749                         "forum" => ["contact", "forum"],
750                         "prv" => ["contact", "prv"],
751                         "contact-type" => ["contact", "contact-type"],
752                         "manually-approve" => ["contact", "manually-approve"],
753                         "hidden" => ["contact", "hidden"],
754                         "archive" => ["contact", "archive"],
755                         "pending" => ["contact", "pending"],
756                         "deleted" => ["contact", "deleted"],
757                         "unsearchable" => ["contact", "unsearchable"],
758                         "sensitive" => ["contact", "sensitive"],
759                         "baseurl" => ["contact", "baseurl"],
760                         "reason" => ["contact", "reason"],
761                         "info" => ["contact", "info"],
762                         "bdyear" => ["contact", "bdyear"],
763                         "bd" => ["contact", "bd"],
764                         "notify_new_posts" => ["contact", "notify_new_posts"],
765                         "fetch_further_information" => ["contact", "fetch_further_information"],
766                         "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
767                         "parent-uid" => ["user", "parent-uid"],
768                         "guid" => ["user", "guid"],
769                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
770                         "email" => ["user", "email"],
771                         "openid" => ["user", "openid"],
772                         "timezone" => ["user", "timezone"],
773                         "language" => ["user", "language"],
774                         "register_date" => ["user", "register_date"],
775                         "login_date" => ["user", "login_date"],
776                         "default-location" => ["user", "default-location"],
777                         "allow_location" => ["user", "allow_location"],
778                         "theme" => ["user", "theme"],
779                         "upubkey" => ["user", "pubkey"],
780                         "uprvkey" => ["user", "prvkey"],
781                         "sprvkey" => ["user", "sprvkey"],
782                         "spubkey" => ["user", "spubkey"],
783                         "verified" => ["user", "verified"],
784                         "blockwall" => ["user", "blockwall"],
785                         "hidewall" => ["user", "hidewall"],
786                         "blocktags" => ["user", "blocktags"],
787                         "unkmail" => ["user", "unkmail"],
788                         "cntunkmail" => ["user", "cntunkmail"],
789                         "notify-flags" => ["user", "notify-flags"],
790                         "page-flags" => ["user", "page-flags"],
791                         "account-type" => ["user", "account-type"],
792                         "prvnets" => ["user", "prvnets"],
793                         "maxreq" => ["user", "maxreq"],
794                         "expire" => ["user", "expire"],
795                         "account_removed" => ["user", "account_removed"],
796                         "account_expired" => ["user", "account_expired"],
797                         "account_expires_on" => ["user", "account_expires_on"],
798                         "expire_notification_sent" => ["user", "expire_notification_sent"],
799                         "def_gid" => ["user", "def_gid"],
800                         "allow_cid" => ["user", "allow_cid"],
801                         "allow_gid" => ["user", "allow_gid"],
802                         "deny_cid" => ["user", "deny_cid"],
803                         "deny_gid" => ["user", "deny_gid"],
804                         "openidserver" => ["user", "openidserver"],
805                         "publish" => ["profile", "publish"],
806                         "net-publish" => ["profile", "net-publish"],
807                         "hide-friends" => ["profile", "hide-friends"],
808                         "prv_keywords" => ["profile", "prv_keywords"],
809                         "pub_keywords" => ["profile", "pub_keywords"],
810                         "address" => ["profile", "address"],
811                         "locality" => ["profile", "locality"],
812                         "region" => ["profile", "region"],
813                         "postal-code" => ["profile", "postal-code"],
814                         "country-name" => ["profile", "country-name"],
815                         "homepage" => ["profile", "homepage"],
816                         "dob" => ["profile", "dob"],
817                 ],
818                 "query" => "FROM `user`
819                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
820                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
821         ],
822         "account-view" => [
823                 "fields" => [
824                         "id" => ["contact", "id"],
825                         "url" => ["contact", "url"],
826                         "nurl" => ["contact", "nurl"],
827                         "uri-id" => ["contact", "uri-id"],
828                         "addr" => ["contact", "addr"],
829                         "alias" => ["contact", "alias"],
830                         "name" => ["contact", "name"],
831                         "nick" => ["contact", "nick"],
832                         "about" => ["contact", "about"],
833                         "keywords" => ["contact", "keywords"],
834                         "xmpp" => ["contact", "xmpp"],
835                         "matrix" => ["contact", "matrix"],
836                         "avatar" => ["contact", "avatar"],
837                         "photo" => ["contact", "photo"],
838                         "thumb" => ["contact", "thumb"],
839                         "micro" => ["contact", "micro"],
840                         "header" => ["contact", "header"],
841                         "created" => ["contact", "created"],
842                         "updated" => ["contact", "updated"],
843                         "network" => ["contact", "network"],
844                         "protocol" => ["contact", "protocol"],
845                         "location" => ["contact", "location"],
846                         "attag" => ["contact", "attag"],
847                         "pubkey" => ["contact", "pubkey"],
848                         "prvkey" => ["contact", "prvkey"],
849                         "subscribe" => ["contact", "subscribe"],
850                         "last-update" => ["contact", "last-update"],
851                         "success_update" => ["contact", "success_update"],
852                         "failure_update" => ["contact", "failure_update"],
853                         "failed" => ["contact", "failed"],
854                         "last-item" => ["contact", "last-item"],
855                         "last-discovery" => ["contact", "last-discovery"],
856                         "contact-type" => ["contact", "contact-type"],
857                         "manually-approve" => ["contact", "manually-approve"],
858                         "unsearchable" => ["contact", "unsearchable"],
859                         "sensitive" => ["contact", "sensitive"],
860                         "baseurl" => ["contact", "baseurl"],
861                         "gsid" => ["contact", "gsid"],
862                         "info" => ["contact", "info"],
863                         "bdyear" => ["contact", "bdyear"],
864                         "bd" => ["contact", "bd"],
865                         "poco" => ["contact", "poco"],
866                         "name-date" => ["contact", "name-date"],
867                         "uri-date" => ["contact", "uri-date"],
868                         "avatar-date" => ["contact", "avatar-date"],
869                         "term-date" => ["contact", "term-date"],
870                         "global-ignored" => ["contact", "hidden"],
871                         "global-blocked" => ["contact", "blocked"],
872                         "hidden" => ["contact", "hidden"],
873                         "archive" => ["contact", "archive"],
874                         "deleted" => ["contact", "deleted"],
875                         "blocked" => ["contact", "blocked"],
876                         "dfrn-request" => ["contact", "request"],
877                         "dfrn-notify" => ["contact", "notify"],
878                         "dfrn-poll" => ["contact", "poll"],
879                         "dfrn-confirm" => ["contact", "confirm"],
880                         "diaspora-guid" => ["fcontact", "guid"],
881                         "diaspora-batch" => ["fcontact", "batch"],
882                         "diaspora-notify" => ["fcontact", "notify"],
883                         "diaspora-poll" => ["fcontact", "poll"],
884                         "diaspora-alias" => ["fcontact", "alias"],
885                         "ap-uuid" => ["apcontact", "uuid"],
886                         "ap-type" => ["apcontact", "type"],
887                         "ap-following" => ["apcontact", "following"],
888                         "ap-followers" => ["apcontact", "followers"],
889                         "ap-inbox" => ["apcontact", "inbox"],
890                         "ap-outbox" => ["apcontact", "outbox"],
891                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
892                         "ap-generator" => ["apcontact", "generator"],
893                         "ap-following_count" => ["apcontact", "following_count"],
894                         "ap-followers_count" => ["apcontact", "followers_count"],
895                         "ap-statuses_count" => ["apcontact", "statuses_count"],
896                 ],
897                 "query" => "FROM `contact`
898                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
899                         LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = contact.`uri-id`
900                         WHERE `contact`.`uid` = 0"                      
901         ],
902         "account-user-view" => [
903                 "fields" => [
904                         "id" => ["ucontact", "id"],
905                         "pid" => ["contact", "id"],
906                         "uid" => ["ucontact", "uid"],
907                         "url" => ["contact", "url"],
908                         "nurl" => ["contact", "nurl"],
909                         "uri-id" => ["contact", "uri-id"],
910                         "addr" => ["contact", "addr"],
911                         "alias" => ["contact", "alias"],
912                         "name" => ["contact", "name"],
913                         "nick" => ["contact", "nick"],
914                         "about" => ["contact", "about"],
915                         "keywords" => ["contact", "keywords"],
916                         "xmpp" => ["contact", "xmpp"],
917                         "matrix" => ["contact", "matrix"],
918                         "avatar" => ["contact", "avatar"],
919                         "photo" => ["contact", "photo"],
920                         "thumb" => ["contact", "thumb"],
921                         "micro" => ["contact", "micro"],
922                         "header" => ["contact", "header"],
923                         "created" => ["contact", "created"],
924                         "updated" => ["contact", "updated"],
925                         "self" => ["ucontact", "self"],
926                         "remote_self" => ["ucontact", "remote_self"],
927                         "rel" =>  ["ucontact", "rel"],
928                         "network" => ["contact", "network"],
929                         "protocol" => ["ucontact", "protocol"],
930                         "location" => ["contact", "location"],
931                         "attag" => ["ucontact", "attag"],
932                         "pubkey" => ["contact", "pubkey"],
933                         "prvkey" => ["contact", "prvkey"],
934                         "subscribe" => ["contact", "subscribe"],
935                         "last-update" => ["contact", "last-update"],
936                         "success_update" => ["contact", "success_update"],
937                         "failure_update" => ["contact", "failure_update"],
938                         "failed" => ["contact", "failed"],
939                         "last-item" => ["contact", "last-item"],
940                         "last-discovery" => ["contact", "last-discovery"],
941                         "contact-type" => ["contact", "contact-type"],
942                         "manually-approve" => ["contact", "manually-approve"],
943                         "unsearchable" => ["contact", "unsearchable"],
944                         "sensitive" => ["contact", "sensitive"],
945                         "baseurl" => ["contact", "baseurl"],
946                         "gsid" => ["contact", "gsid"],
947                         "info" => ["ucontact", "info"],
948                         "bdyear" => ["contact", "bdyear"],
949                         "bd" => ["contact", "bd"],
950                         "poco" => ["contact", "poco"],
951                         "name-date" => ["contact", "name-date"],
952                         "uri-date" => ["contact", "uri-date"],
953                         "avatar-date" => ["contact", "avatar-date"],
954                         "term-date" => ["contact", "term-date"],
955                         "global-ignored" => ["contact", "hidden"],
956                         "global-blocked" => ["contact", "blocked"],
957                         "hidden" => ["ucontact", "hidden"],
958                         "archive" => ["ucontact", "archive"],
959                         "pending" => ["ucontact", "pending"],
960                         "deleted" => ["ucontact", "deleted"],
961                         "notify_new_posts" => ["ucontact", "notify_new_posts"],
962                         "fetch_further_information" => ["ucontact", "fetch_further_information"],
963                         "ffi_keyword_denylist" => ["ucontact", "ffi_keyword_denylist"],
964                         "rating" => ["ucontact", "rating"],
965                         "readonly" => ["ucontact", "readonly"],
966                         "blocked" => ["ucontact", "blocked"],
967                         "block_reason" => ["ucontact", "block_reason"],
968                         "subhub" => ["ucontact", "subhub"],
969                         "hub-verify" => ["ucontact", "hub-verify"],
970                         "reason" => ["ucontact", "reason"],
971                         "dfrn-request" => ["contact", "request"],
972                         "dfrn-notify" => ["contact", "notify"],
973                         "dfrn-poll" => ["contact", "poll"],
974                         "dfrn-confirm" => ["contact", "confirm"],
975                         "diaspora-guid" => ["fcontact", "guid"],
976                         "diaspora-batch" => ["fcontact", "batch"],
977                         "diaspora-notify" => ["fcontact", "notify"],
978                         "diaspora-poll" => ["fcontact", "poll"],
979                         "diaspora-alias" => ["fcontact", "alias"],
980                         "ap-uuid" => ["apcontact", "uuid"],
981                         "ap-type" => ["apcontact", "type"],
982                         "ap-following" => ["apcontact", "following"],
983                         "ap-followers" => ["apcontact", "followers"],
984                         "ap-inbox" => ["apcontact", "inbox"],
985                         "ap-outbox" => ["apcontact", "outbox"],
986                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
987                         "ap-generator" => ["apcontact", "generator"],
988                         "ap-following_count" => ["apcontact", "following_count"],
989                         "ap-followers_count" => ["apcontact", "followers_count"],
990                         "ap-statuses_count" => ["apcontact", "statuses_count"],
991                 ],
992                 "query" => "FROM `contact` AS `ucontact`
993                         INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
994                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
995                         LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = `ucontact`.`uri-id` AND `fcontact`.`network` = 'dspr'"
996         ],
997         "pending-view" => [
998                 "fields" => [
999                         "id" => ["register", "id"],
1000                         "hash" => ["register", "hash"],
1001                         "created" => ["register", "created"],
1002                         "uid" => ["register", "uid"],
1003                         "password" => ["register", "password"],
1004                         "language" => ["register", "language"],
1005                         "note" => ["register", "note"],
1006                         "self" => ["contact", "self"],
1007                         "name" => ["contact", "name"],
1008                         "url" => ["contact", "url"],
1009                         "micro" => ["contact", "micro"],
1010                         "email" => ["user", "email"],
1011                         "nick" => ["contact", "nick"],
1012                 ],
1013                 "query" => "FROM `register`
1014                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1015                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
1016         ],
1017         "tag-search-view" => [
1018                 "fields" => [
1019                         "uri-id" => ["post-tag", "uri-id"],
1020                         "uid" => ["post-user", "uid"],
1021                         "iid" => ["post-user", "id"],
1022                         "private" => ["post-user", "private"],
1023                         "wall" => ["post-user", "wall"],
1024                         "origin" => ["post-user", "origin"],
1025                         "global" => ["post-user", "global"],
1026                         "gravity" => ["post-user", "gravity"],
1027                         "received" => ["post-user", "received"],
1028                         "network" => ["post-user", "network"],
1029                         "author-id" => ["post-user", "author-id"],
1030                         "name" => ["tag", "name"],
1031                 ],
1032                 "query" => "FROM `post-tag`
1033                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1034                         STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
1035                         WHERE `post-tag`.`type` = 1"
1036         ],
1037         "workerqueue-view" => [
1038                 "fields" => [
1039                         "pid" => ["process", "pid"],
1040                         "priority" => ["workerqueue", "priority"],
1041                 ],
1042                 "query" => "FROM `process`
1043                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1044                         WHERE NOT `workerqueue`.`done`"
1045         ],
1046 ];
1047