]> git.mxchange.org Git - friendica.git/blob - static/dbview.config.php
Changes:
[friendica.git] / static / dbview.config.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2010-2024, 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         "circle-member-view" => [
62                 "fields" => [
63                         "id" => ["group_member", "id"],
64                         "uid" => ["group", "uid"],
65                         "contact-id" => ["group_member", "contact-id"],
66                         "contact-uri-id" => ["contact", "uri-id"],
67                         "contact-link" => ["contact", "url"],
68                         "contact-addr" => ["contact", "addr"],
69                         "contact-name" => ["contact", "name"],
70                         "contact-nick" => ["contact", "nick"],
71                         "contact-avatar" => ["contact", "thumb"],
72                         "contact-network" => ["contact", "network"],
73                         "contact-blocked" => ["contact", "blocked"],
74                         "contact-hidden" => ["contact", "hidden"],
75                         "contact-readonly" => ["contact", "readonly"],
76                         "contact-archive" => ["contact", "archive"],
77                         "contact-pending" => ["contact", "pending"],
78                         "contact-self" => ["contact", "self"],
79                         "contact-rel" => ["contact", "rel"],
80                         "contact-contact-type" => ["contact", "contact-type"],
81                         "circle-id" => ["group_member", "gid"],
82                         "circle-visible" => ["group", "visible"],
83                         "circle-deleted" => ["group", "deleted"],
84                         "circle-name" => ["group", "name"],
85                 ],
86                 "query" => "FROM `group_member`
87                         INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id`
88                         INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`"
89         ],
90         "post-counts-view" => [
91                 "fields" => [
92                         "uri-id" => ["post-counts", "uri-id"],
93                         "vid" => ["post-counts", "vid"],
94                         "verb" => ["verb", "name"],
95                         "reaction" => ["post-counts", "reaction"],
96                         "parent-uri-id" => ["post-counts", "parent-uri-id"],
97                         "count" => ["post-counts", "count"],
98                 ],
99                 "query" => "FROM `post-counts`
100                         INNER JOIN `verb` ON `verb`.`id` = `post-counts`.`vid`"
101         ],
102         "post-timeline-view" => [
103                 "fields" => [
104                         "uid" => ["post-user", "uid"],
105                         "uri-id" => ["post-user", "uri-id"],
106                         "gravity" => ["post-user", "gravity"],
107                         "created" => ["post-user", "created"],
108                         "edited" => ["post-user", "edited"],
109                         "commented" => ["post-thread-user", "commented"],
110                         "received" => ["post-user", "received"],
111                         "changed" => ["post-thread-user", "changed"],
112                         "private" => ["post-user", "private"],
113                         "visible" => ["post-user", "visible"],
114                         "deleted" => ["post-user", "deleted"],
115                         "origin" => ["post-user", "origin"],
116                         "global" => ["post-user", "global"],
117                         "network" => ["post-user", "network"],
118                         "protocol" => ["post-user", "protocol"],
119                         "vid" => ["post-user", "vid"],
120                         "contact-id" => ["post-user", "contact-id"],
121                         "contact-blocked" => ["contact", "blocked"],
122                         "contact-readonly" => ["contact", "readonly"],
123                         "contact-pending" => ["contact", "pending"],
124                         "contact-rel" => ["contact", "rel"],
125                         "contact-uid" => ["contact", "uid"],
126                         "self" => ["contact", "self"],
127                         "author-id" => ["post-user", "author-id"],
128                         "author-blocked" => ["author", "blocked"],
129                         "author-hidden" => ["author", "hidden"],
130                         "author-gsid" => ["author", "gsid"],
131                         "owner-id" => ["post-user", "owner-id"],
132                         "owner-blocked" => ["owner", "blocked"],
133                         "owner-gsid" => ["owner", "gsid"],
134                         "causer-id" => ["post-user", "causer-id"],
135                         "causer-blocked" => ["causer", "blocked"],
136                         "causer-gsid" => ["causer", "gsid"],
137                 ],
138                 "query" => "FROM `post-user`
139                         LEFT JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
140                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
141                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
142                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
143                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`"
144         ],
145         "post-user-view" => [
146                 "fields" => [
147                         "id" => ["post-user", "id"],
148                         "post-user-id" => ["post-user", "id"],
149                         "uid" => ["post-user", "uid"],
150                         "parent" => ["post-thread-user", "post-user-id"],
151                         "uri" => ["item-uri", "uri"],
152                         "uri-id" => ["post-user", "uri-id"],
153                         "parent-uri" => ["parent-item-uri", "uri"],
154                         "parent-uri-id" => ["post-user", "parent-uri-id"],
155                         "thr-parent" => ["thr-parent-item-uri", "uri"],
156                         "thr-parent-id" => ["post-user", "thr-parent-id"],
157                         "conversation" => ["conversation-item-uri", "uri"],
158                         "conversation-id" => ["post-thread-user", "conversation-id"],
159                         "quote-uri" => ["quote-item-uri", "uri"],
160                         "quote-uri-id" => ["post-content", "quote-uri-id"],
161                         "guid" => ["item-uri", "guid"],
162                         "wall" => ["post-user", "wall"],
163                         "gravity" => ["post-user", "gravity"],
164                         "extid" => ["external-item-uri", "uri"],
165                         "external-id" => ["post-user", "external-id"],
166                         "created" => ["post-user", "created"],
167                         "edited" => ["post-user", "edited"],
168                         "commented" => ["post-thread-user", "commented"],
169                         "received" => ["post-user", "received"],
170                         "changed" => ["post-thread-user", "changed"],
171                         "post-type" => ["post-user", "post-type"],
172                         "post-reason" => ["post-user", "post-reason"],
173                         "private" => ["post-user", "private"],
174                         "pubmail" => ["post-thread-user", "pubmail"],
175                         "visible" => ["post-user", "visible"],
176                         "starred" => ["post-thread-user", "starred"],
177                         "unseen" => ["post-user", "unseen"],
178                         "deleted" => ["post-user", "deleted"],
179                         "origin" => ["post-user", "origin"],
180                         "parent-origin" => ["post-thread-user", "origin"],
181                         "mention" => ["post-thread-user", "mention"],
182                         "global" => ["post-user", "global"],
183                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-user`.`uri-id`)",
184                         "network" => ["post-user", "network"],
185                         "protocol" => ["post-user", "protocol"],
186                         "vid" => ["post-user", "vid"],
187                         "psid" => ["post-user", "psid"],
188                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
189                         "title" => ["post-content", "title"],
190                         "content-warning" => ["post-content", "content-warning"],
191                         "raw-body" => ["post-content", "raw-body"],
192                         "body" => "IFNULL (`post-content`.`body`, '')",
193                         "rendered-hash" => ["post-content", "rendered-hash"],
194                         "rendered-html" => ["post-content", "rendered-html"],
195                         "language" => ["post-content", "language"],
196                         "plink" => ["post-content", "plink"],
197                         "location" => ["post-content", "location"],
198                         "coord" => ["post-content", "coord"],
199                         "app" => ["post-content", "app"],
200                         "object-type" => ["post-content", "object-type"],
201                         "object" => ["post-content", "object"],
202                         "target-type" => ["post-content", "target-type"],
203                         "target" => ["post-content", "target"],
204                         "resource-id" => ["post-content", "resource-id"],
205                         "contact-id" => ["post-user", "contact-id"],
206                         "contact-uri-id" => ["contact", "uri-id"],
207                         "contact-link" => ["contact", "url"],
208                         "contact-addr" => ["contact", "addr"],
209                         "contact-name" => ["contact", "name"],
210                         "contact-nick" => ["contact", "nick"],
211                         "contact-avatar" => ["contact", "thumb"],
212                         "contact-network" => ["contact", "network"],
213                         "contact-blocked" => ["contact", "blocked"],
214                         "contact-hidden" => ["contact", "hidden"],
215                         "contact-readonly" => ["contact", "readonly"],
216                         "contact-archive" => ["contact", "archive"],
217                         "contact-pending" => ["contact", "pending"],
218                         "contact-rel" => ["contact", "rel"],
219                         "contact-uid" => ["contact", "uid"],
220                         "contact-contact-type" => ["contact", "contact-type"],
221                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
222                         "self" => ["contact", "self"],
223                         "cid" => ["contact", "id"],
224                         "alias" => ["contact", "alias"],
225                         "photo" => ["contact", "photo"],
226                         "name-date" => ["contact", "name-date"],
227                         "uri-date" => ["contact", "uri-date"],
228                         "avatar-date" => ["contact", "avatar-date"],
229                         "thumb" => ["contact", "thumb"],
230                         "author-id" => ["post-user", "author-id"],
231                         "author-uri-id" => ["author", "uri-id"],
232                         "author-link" => ["author", "url"],
233                         "author-addr" => ["author", "addr"],
234                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
235                         "author-nick" => ["author", "nick"],
236                         "author-alias" => ["author", "alias"],
237                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
238                         "author-network" => ["author", "network"],
239                         "author-blocked" => ["author", "blocked"],
240                         "author-hidden" => ["author", "hidden"],
241                         "author-updated" => ["author", "updated"],
242                         "author-contact-type" => ["author", "contact-type"],
243                         "author-gsid" => ["author", "gsid"],
244                         "author-baseurl" => ["author", "baseurl"],
245                         "owner-id" => ["post-user", "owner-id"],
246                         "owner-uri-id" => ["owner", "uri-id"],
247                         "owner-link" => ["owner", "url"],
248                         "owner-addr" => ["owner", "addr"],
249                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
250                         "owner-nick" => ["owner", "nick"],
251                         "owner-alias" => ["owner", "alias"],
252                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
253                         "owner-network" => ["owner", "network"],
254                         "owner-blocked" => ["owner", "blocked"],
255                         "owner-hidden" => ["owner", "hidden"],
256                         "owner-updated" => ["owner", "updated"],
257                         "owner-gsid" => ["owner", "gsid"],
258                         "owner-contact-type" => ["owner", "contact-type"],
259                         "causer-id" => ["post-user", "causer-id"],
260                         "causer-uri-id" => ["causer", "uri-id"],
261                         "causer-link" => ["causer", "url"],
262                         "causer-addr" => ["causer", "addr"],
263                         "causer-name" => ["causer", "name"],
264                         "causer-nick" => ["causer", "nick"],
265                         "causer-alias" => ["causer", "alias"],
266                         "causer-avatar" => ["causer", "thumb"],
267                         "causer-network" => ["causer", "network"],
268                         "causer-blocked" => ["causer", "blocked"],
269                         "causer-hidden" => ["causer", "hidden"],
270                         "causer-gsid" => ["causer", "gsid"],
271                         "causer-contact-type" => ["causer", "contact-type"],
272                         "postopts" => ["post-delivery-data", "postopts"],
273                         "inform" => ["post-delivery-data", "inform"],
274                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
275                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
276                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
277                         "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
278                         "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
279                         "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
280                         "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
281                         "event-id" => ["post-user", "event-id"],
282                         "event-created" => ["event", "created"],
283                         "event-edited" => ["event", "edited"],
284                         "event-start" => ["event", "start"],
285                         "event-finish" => ["event", "finish"],
286                         "event-summary" => ["event", "summary"],
287                         "event-desc" => ["event", "desc"],
288                         "event-location" => ["event", "location"],
289                         "event-type" => ["event", "type"],
290                         "event-nofinish" => ["event", "nofinish"],
291                         "event-ignore" => ["event", "ignore"],
292                         "question-id" => ["post-question", "id"],
293                         "question-multiple" => ["post-question", "multiple"],
294                         "question-voters" => ["post-question", "voters"],
295                         "question-end-time" => ["post-question", "end-time"],
296                         "has-categories" => "EXISTS(SELECT `uri-id` FROM `post-category` WHERE `post-category`.`uri-id` = `post-user`.`uri-id` AND `post-category`.`uid` = `post-user`.`uid`)",
297                         "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-user`.`uri-id`)",
298                         "signed_text" => ["diaspora-interaction", "interaction"],
299                         "parent-guid" => ["parent-item-uri", "guid"],
300                         "parent-network" => ["post-thread-user", "network"],
301                         "parent-author-id" => ["post-thread-user", "author-id"],
302                         "parent-author-link" => ["parent-post-author", "url"],
303                         "parent-author-name" => ["parent-post-author", "name"],
304                         "parent-author-nick" => ["parent-post-author", "nick"],
305                         "parent-author-network" => ["parent-post-author", "network"],
306                 ],
307                 "query" => "FROM `post-user`
308                         INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
309                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
310                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
311                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
312                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
313                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
314                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
315                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
316                         LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
317                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
318                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
319                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
320                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
321                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
322                         LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
323                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
324                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-user`.`uri-id`
325                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
326                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread-user`.`author-id`"
327         ],
328         "post-thread-user-view" => [
329                 "fields" => [
330                         "id" => ["post-user", "id"],
331                         "post-user-id" => ["post-user", "id"],
332                         "uid" => ["post-thread-user", "uid"],
333                         "parent" => ["post-thread-user", "post-user-id"],
334                         "uri" => ["item-uri", "uri"],
335                         "uri-id" => ["post-thread-user", "uri-id"],
336                         "parent-uri" => ["parent-item-uri", "uri"],
337                         "parent-uri-id" => ["post-user", "parent-uri-id"],
338                         "thr-parent" => ["thr-parent-item-uri", "uri"],
339                         "thr-parent-id" => ["post-user", "thr-parent-id"],
340                         "conversation" => ["conversation-item-uri", "uri"],
341                         "conversation-id" => ["post-thread-user", "conversation-id"],
342                         "quote-uri" => ["quote-item-uri", "uri"],
343                         "quote-uri-id" => ["post-content", "quote-uri-id"],
344                         "guid" => ["item-uri", "guid"],
345                         "wall" => ["post-thread-user", "wall"],
346                         "gravity" => ["post-user", "gravity"],
347                         "extid" => ["external-item-uri", "uri"],
348                         "external-id" => ["post-user", "external-id"],
349                         "created" => ["post-thread-user", "created"],
350                         "edited" => ["post-user", "edited"],
351                         "commented" => ["post-thread-user", "commented"],
352                         "received" => ["post-thread-user", "received"],
353                         "changed" => ["post-thread-user", "changed"],
354                         "post-type" => ["post-user", "post-type"],
355                         "post-reason" => ["post-user", "post-reason"],
356                         "private" => ["post-user", "private"],
357                         "pubmail" => ["post-thread-user", "pubmail"],
358                         "ignored" => ["post-thread-user", "ignored"],
359                         "visible" => ["post-user", "visible"],
360                         "starred" => ["post-thread-user", "starred"],
361                         "unseen" => ["post-thread-user", "unseen"],
362                         "deleted" => ["post-user", "deleted"],
363                         "origin" => ["post-thread-user", "origin"],
364                         "mention" => ["post-thread-user", "mention"],
365                         "global" => ["post-user", "global"],
366                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread-user`.`uri-id`)",
367                         "network" => ["post-thread-user", "network"],
368                         "vid" => ["post-user", "vid"],
369                         "psid" => ["post-thread-user", "psid"],
370                         "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
371                         "title" => ["post-content", "title"],
372                         "content-warning" => ["post-content", "content-warning"],
373                         "raw-body" => ["post-content", "raw-body"],
374                         "body" => ["post-content", "body"],
375                         "rendered-hash" => ["post-content", "rendered-hash"],
376                         "rendered-html" => ["post-content", "rendered-html"],
377                         "language" => ["post-content", "language"],
378                         "plink" => ["post-content", "plink"],
379                         "location" => ["post-content", "location"],
380                         "coord" => ["post-content", "coord"],
381                         "app" => ["post-content", "app"],
382                         "object-type" => ["post-content", "object-type"],
383                         "object" => ["post-content", "object"],
384                         "target-type" => ["post-content", "target-type"],
385                         "target" => ["post-content", "target"],
386                         "resource-id" => ["post-content", "resource-id"],
387                         "contact-id" => ["post-thread-user", "contact-id"],
388                         "contact-uri-id" => ["contact", "uri-id"],
389                         "contact-link" => ["contact", "url"],
390                         "contact-addr" => ["contact", "addr"],
391                         "contact-name" => ["contact", "name"],
392                         "contact-nick" => ["contact", "nick"],
393                         "contact-avatar" => ["contact", "thumb"],
394                         "contact-network" => ["contact", "network"],
395                         "contact-blocked" => ["contact", "blocked"],
396                         "contact-hidden" => ["contact", "hidden"],
397                         "contact-readonly" => ["contact", "readonly"],
398                         "contact-archive" => ["contact", "archive"],
399                         "contact-pending" => ["contact", "pending"],
400                         "contact-rel" => ["contact", "rel"],
401                         "contact-uid" => ["contact", "uid"],
402                         "contact-gsid" => ["contact", "gsid"],
403                         "contact-contact-type" => ["contact", "contact-type"],
404                         "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
405                         "self" => ["contact", "self"],
406                         "cid" => ["contact", "id"],
407                         "alias" => ["contact", "alias"],
408                         "photo" => ["contact", "photo"],
409                         "name-date" => ["contact", "name-date"],
410                         "uri-date" => ["contact", "uri-date"],
411                         "avatar-date" => ["contact", "avatar-date"],
412                         "thumb" => ["contact", "thumb"],
413                         "author-id" => ["post-thread-user", "author-id"],
414                         "author-uri-id" => ["author", "uri-id"],
415                         "author-link" => ["author", "url"],
416                         "author-addr" => ["author", "addr"],
417                         "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
418                         "author-nick" => ["author", "nick"],
419                         "author-alias" => ["author", "alias"],
420                         "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
421                         "author-network" => ["author", "network"],
422                         "author-blocked" => ["author", "blocked"],
423                         "author-hidden" => ["author", "hidden"],
424                         "author-updated" => ["author", "updated"],
425                         "author-contact-type" => ["author", "contact-type"],
426                         "author-gsid" => ["author", "gsid"],
427                         "owner-id" => ["post-thread-user", "owner-id"],
428                         "owner-uri-id" => ["owner", "uri-id"],
429                         "owner-link" => ["owner", "url"],
430                         "owner-addr" => ["owner", "addr"],
431                         "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
432                         "owner-nick" => ["owner", "nick"],
433                         "owner-alias" => ["owner", "alias"],
434                         "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
435                         "owner-network" => ["owner", "network"],
436                         "owner-blocked" => ["owner", "blocked"],
437                         "owner-hidden" => ["owner", "hidden"],
438                         "owner-updated" => ["owner", "updated"],
439                         "owner-gsid" => ["owner", "gsid"],
440                         "owner-contact-type" => ["owner", "contact-type"],
441                         "causer-id" => ["post-thread-user", "causer-id"],
442                         "causer-uri-id" => ["causer", "uri-id"],
443                         "causer-link" => ["causer", "url"],
444                         "causer-addr" => ["causer", "addr"],
445                         "causer-name" => ["causer", "name"],
446                         "causer-nick" => ["causer", "nick"],
447                         "causer-alias" => ["causer", "alias"],
448                         "causer-avatar" => ["causer", "thumb"],
449                         "causer-network" => ["causer", "network"],
450                         "causer-blocked" => ["causer", "blocked"],
451                         "causer-hidden" => ["causer", "hidden"],
452                         "causer-gsid" => ["causer", "gsid"],
453                         "causer-contact-type" => ["causer", "contact-type"],
454                         "postopts" => ["post-delivery-data", "postopts"],
455                         "inform" => ["post-delivery-data", "inform"],
456                         "delivery_queue_count" => ["post-delivery-data", "queue_count"],
457                         "delivery_queue_done" => ["post-delivery-data", "queue_done"],
458                         "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
459                         "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
460                         "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
461                         "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
462                         "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
463                         "event-id" => ["post-user", "event-id"],
464                         "event-created" => ["event", "created"],
465                         "event-edited" => ["event", "edited"],
466                         "event-start" => ["event", "start"],
467                         "event-finish" => ["event", "finish"],
468                         "event-summary" => ["event", "summary"],
469                         "event-desc" => ["event", "desc"],
470                         "event-location" => ["event", "location"],
471                         "event-type" => ["event", "type"],
472                         "event-nofinish" => ["event", "nofinish"],
473                         "event-ignore" => ["event", "ignore"],
474                         "question-id" => ["post-question", "id"],
475                         "question-multiple" => ["post-question", "multiple"],
476                         "question-voters" => ["post-question", "voters"],
477                         "question-end-time" => ["post-question", "end-time"],
478                         "has-categories" => "EXISTS(SELECT `uri-id` FROM `post-category` WHERE `post-category`.`uri-id` = `post-thread-user`.`uri-id` AND `post-category`.`uid` = `post-thread-user`.`uid`)",
479                         "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread-user`.`uri-id`)",
480                         "signed_text" => ["diaspora-interaction", "interaction"],
481                         "parent-guid" => ["parent-item-uri", "guid"],
482                         "parent-network" => ["post-thread-user", "network"],
483                         "parent-author-id" => ["post-thread-user", "author-id"],
484                         "parent-author-link" => ["author", "url"],
485                         "parent-author-name" => ["author", "name"],
486                         "parent-author-nick" => ["author", "nick"],
487                         "parent-author-network" => ["author", "network"],
488                 ],
489                 "query" => "FROM `post-thread-user`
490                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
491                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
492                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
493                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
494                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
495                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
496                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
497                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
498                         LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread-user`.`conversation-id`
499                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
500                         LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
501                         LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
502                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
503                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
504                         LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
505                         LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
506                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread-user`.`uri-id`
507                         LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`"
508         ],
509         "post-view" => [
510                 "fields" => [
511                         "uri" => ["item-uri", "uri"],
512                         "uri-id" => ["post", "uri-id"],
513                         "parent-uri" => ["parent-item-uri", "uri"],
514                         "parent-uri-id" => ["post", "parent-uri-id"],
515                         "thr-parent" => ["thr-parent-item-uri", "uri"],
516                         "thr-parent-id" => ["post", "thr-parent-id"],
517                         "conversation" => ["conversation-item-uri", "uri"],
518                         "conversation-id" => ["post-thread", "conversation-id"],
519                         "quote-uri" => ["quote-item-uri", "uri"],
520                         "quote-uri-id" => ["post-content", "quote-uri-id"],
521                         "guid" => ["item-uri", "guid"],
522                         "gravity" => ["post", "gravity"],
523                         "extid" => ["external-item-uri", "uri"],
524                         "external-id" => ["post", "external-id"],
525                         "created" => ["post", "created"],
526                         "edited" => ["post", "edited"],
527                         "commented" => ["post-thread", "commented"],
528                         "received" => ["post", "received"],
529                         "changed" => ["post-thread", "changed"],
530                         "post-type" => ["post", "post-type"],
531                         "private" => ["post", "private"],
532                         "visible" => ["post", "visible"],
533                         "deleted" => ["post", "deleted"],
534                         "global" => ["post", "global"],
535                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post`.`uri-id`)",
536                         "network" => ["post", "network"],
537                         "vid" => ["post", "vid"],
538                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
539                         "title" => ["post-content", "title"],
540                         "content-warning" => ["post-content", "content-warning"],
541                         "raw-body" => ["post-content", "raw-body"],
542                         "body" => ["post-content", "body"],
543                         "rendered-hash" => ["post-content", "rendered-hash"],
544                         "rendered-html" => ["post-content", "rendered-html"],
545                         "language" => ["post-content", "language"],
546                         "plink" => ["post-content", "plink"],
547                         "location" => ["post-content", "location"],
548                         "coord" => ["post-content", "coord"],
549                         "app" => ["post-content", "app"],
550                         "object-type" => ["post-content", "object-type"],
551                         "object" => ["post-content", "object"],
552                         "target-type" => ["post-content", "target-type"],
553                         "target" => ["post-content", "target"],
554                         "resource-id" => ["post-content", "resource-id"],
555                         "contact-id" => ["post", "author-id"],
556                         "contact-uri-id" => ["author", "uri-id"],
557                         "contact-link" => ["author", "url"],
558                         "contact-addr" => ["author", "addr"],
559                         "contact-name" => ["author", "name"],
560                         "contact-nick" => ["author", "nick"],
561                         "contact-avatar" => ["author", "thumb"],
562                         "contact-network" => ["author", "network"],
563                         "contact-blocked" => ["author", "blocked"],
564                         "contact-hidden" => ["author", "hidden"],
565                         "contact-readonly" => ["author", "readonly"],
566                         "contact-archive" => ["author", "archive"],
567                         "contact-pending" => ["author", "pending"],
568                         "contact-rel" => ["author", "rel"],
569                         "contact-uid" => ["author", "uid"],
570                         "contact-contact-type" => ["author", "contact-type"],
571                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
572                         "self" => "false",
573                         "cid" => ["author", "id"],
574                         "alias" => ["author", "alias"],
575                         "photo" => ["author", "photo"],
576                         "name-date" => ["author", "name-date"],
577                         "uri-date" => ["author", "uri-date"],
578                         "avatar-date" => ["author", "avatar-date"],
579                         "thumb" => ["author", "thumb"],
580                         "author-id" => ["post", "author-id"],
581                         "author-uri-id" => ["author", "uri-id"],
582                         "author-link" => ["author", "url"],
583                         "author-addr" => ["author", "addr"],
584                         "author-name" => ["author", "name"],
585                         "author-nick" => ["author", "nick"],
586                         "author-alias" => ["author", "alias"],
587                         "author-avatar" => ["author", "thumb"],
588                         "author-network" => ["author", "network"],
589                         "author-blocked" => ["author", "blocked"],
590                         "author-hidden" => ["author", "hidden"],
591                         "author-updated" => ["author", "updated"],
592                         "author-contact-type" => ["author", "contact-type"],
593                         "author-gsid" => ["author", "gsid"],
594                         "owner-id" => ["post", "owner-id"],
595                         "owner-uri-id" => ["owner", "uri-id"],
596                         "owner-link" => ["owner", "url"],
597                         "owner-addr" => ["owner", "addr"],
598                         "owner-name" => ["owner", "name"],
599                         "owner-nick" => ["owner", "nick"],
600                         "owner-alias" => ["owner", "alias"],
601                         "owner-avatar" => ["owner", "thumb"],
602                         "owner-network" => ["owner", "network"],
603                         "owner-blocked" => ["owner", "blocked"],
604                         "owner-hidden" => ["owner", "hidden"],
605                         "owner-updated" => ["owner", "updated"],
606                         "owner-contact-type" => ["owner", "contact-type"],
607                         "owner-gsid" => ["owner", "gsid"],
608                         "causer-id" => ["post", "causer-id"],
609                         "causer-uri-id" => ["causer", "uri-id"],
610                         "causer-link" => ["causer", "url"],
611                         "causer-addr" => ["causer", "addr"],
612                         "causer-name" => ["causer", "name"],
613                         "causer-nick" => ["causer", "nick"],
614                         "causer-alias" => ["causer", "alias"],
615                         "causer-avatar" => ["causer", "thumb"],
616                         "causer-network" => ["causer", "network"],
617                         "causer-blocked" => ["causer", "blocked"],
618                         "causer-hidden" => ["causer", "hidden"],
619                         "causer-contact-type" => ["causer", "contact-type"],
620                         "causer-gsid" => ["causer", "gsid"],
621                         "question-id" => ["post-question", "id"],
622                         "question-multiple" => ["post-question", "multiple"],
623                         "question-voters" => ["post-question", "voters"],
624                         "question-end-time" => ["post-question", "end-time"],
625                         "has-categories" => "0",
626                         "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post`.`uri-id`)",
627                         "signed_text" => ["diaspora-interaction", "interaction"],
628                         "parent-guid" => ["parent-item-uri", "guid"],
629                         "parent-network" => ["post-thread", "network"],
630                         "parent-author-id" => ["post-thread", "author-id"],
631                         "parent-author-link" => ["parent-post-author", "url"],
632                         "parent-author-name" => ["parent-post-author", "name"],
633                         "parent-author-nick" => ["parent-post-author", "nick"],
634                         "parent-author-network" => ["parent-post-author", "network"],
635                 ],
636                 "query" => "FROM `post`
637                         STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
638                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
639                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
640                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
641                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
642                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
643                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
644                         LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
645                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
646                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
647                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
648                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
649                         LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
650                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post`.`uri-id`
651                         LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `post-thread`.`author-id`"
652         ],
653         "post-thread-view" => [
654                 "fields" => [
655                         "uri" => ["item-uri", "uri"],
656                         "uri-id" => ["post-thread", "uri-id"],
657                         "parent-uri" => ["parent-item-uri", "uri"],
658                         "parent-uri-id" => ["post", "parent-uri-id"],
659                         "thr-parent" => ["thr-parent-item-uri", "uri"],
660                         "thr-parent-id" => ["post", "thr-parent-id"],
661                         "conversation" => ["conversation-item-uri", "uri"],
662                         "conversation-id" => ["post-thread", "conversation-id"],
663                         "quote-uri" => ["quote-item-uri", "uri"],
664                         "quote-uri-id" => ["post-content", "quote-uri-id"],
665                         "guid" => ["item-uri", "guid"],
666                         "gravity" => ["post", "gravity"],
667                         "extid" => ["external-item-uri", "uri"],
668                         "external-id" => ["post", "external-id"],
669                         "created" => ["post-thread", "created"],
670                         "edited" => ["post", "edited"],
671                         "commented" => ["post-thread", "commented"],
672                         "received" => ["post-thread", "received"],
673                         "changed" => ["post-thread", "changed"],
674                         "post-type" => ["post", "post-type"],
675                         "private" => ["post", "private"],
676                         "visible" => ["post", "visible"],
677                         "deleted" => ["post", "deleted"],
678                         "global" => ["post", "global"],
679                         "featured" => "EXISTS(SELECT `type` FROM `post-collection` WHERE `type` = 0 AND `uri-id` = `post-thread`.`uri-id`)",
680                         "network" => ["post-thread", "network"],
681                         "vid" => ["post", "vid"],
682                         "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
683                         "title" => ["post-content", "title"],
684                         "content-warning" => ["post-content", "content-warning"],
685                         "raw-body" => ["post-content", "raw-body"],
686                         "body" => ["post-content", "body"],
687                         "rendered-hash" => ["post-content", "rendered-hash"],
688                         "rendered-html" => ["post-content", "rendered-html"],
689                         "language" => ["post-content", "language"],
690                         "plink" => ["post-content", "plink"],
691                         "location" => ["post-content", "location"],
692                         "coord" => ["post-content", "coord"],
693                         "app" => ["post-content", "app"],
694                         "object-type" => ["post-content", "object-type"],
695                         "object" => ["post-content", "object"],
696                         "target-type" => ["post-content", "target-type"],
697                         "target" => ["post-content", "target"],
698                         "resource-id" => ["post-content", "resource-id"],
699                         "contact-id" => ["post-thread", "author-id"],
700                         "contact-uri-id" => ["author", "uri-id"],
701                         "contact-link" => ["author", "url"],
702                         "contact-addr" => ["author", "addr"],
703                         "contact-name" => ["author", "name"],
704                         "contact-nick" => ["author", "nick"],
705                         "contact-avatar" => ["author", "thumb"],
706                         "contact-network" => ["author", "network"],
707                         "contact-blocked" => ["author", "blocked"],
708                         "contact-hidden" => ["author", "hidden"],
709                         "contact-readonly" => ["author", "readonly"],
710                         "contact-archive" => ["author", "archive"],
711                         "contact-pending" => ["author", "pending"],
712                         "contact-rel" => ["author", "rel"],
713                         "contact-uid" => ["author", "uid"],
714                         "contact-contact-type" => ["author", "contact-type"],
715                         "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
716                         "self" => "false",
717                         "cid" => ["author", "id"],
718                         "alias" => ["author", "alias"],
719                         "photo" => ["author", "photo"],
720                         "name-date" => ["author", "name-date"],
721                         "uri-date" => ["author", "uri-date"],
722                         "avatar-date" => ["author", "avatar-date"],
723                         "thumb" => ["author", "thumb"],
724                         "author-id" => ["post-thread", "author-id"],
725                         "author-uri-id" => ["author", "uri-id"],
726                         "author-link" => ["author", "url"],
727                         "author-addr" => ["author", "addr"],
728                         "author-name" => ["author", "name"],
729                         "author-nick" => ["author", "nick"],
730                         "author-alias" => ["author", "alias"],
731                         "author-avatar" => ["author", "thumb"],
732                         "author-network" => ["author", "network"],
733                         "author-blocked" => ["author", "blocked"],
734                         "author-hidden" => ["author", "hidden"],
735                         "author-updated" => ["author", "updated"],
736                         "author-contact-type" => ["author", "contact-type"],
737                         "author-gsid" => ["author", "gsid"],
738                         "owner-id" => ["post-thread", "owner-id"],
739                         "owner-uri-id" => ["owner", "uri-id"],
740                         "owner-link" => ["owner", "url"],
741                         "owner-addr" => ["owner", "addr"],
742                         "owner-name" => ["owner", "name"],
743                         "owner-nick" => ["owner", "nick"],
744                         "owner-alias" => ["owner", "alias"],
745                         "owner-avatar" => ["owner", "thumb"],
746                         "owner-network" => ["owner", "network"],
747                         "owner-blocked" => ["owner", "blocked"],
748                         "owner-hidden" => ["owner", "hidden"],
749                         "owner-updated" => ["owner", "updated"],
750                         "owner-gsid" => ["owner", "gsid"],
751                         "owner-contact-type" => ["owner", "contact-type"],
752                         "causer-id" => ["post-thread", "causer-id"],
753                         "causer-uri-id" => ["causer", "uri-id"],
754                         "causer-link" => ["causer", "url"],
755                         "causer-addr" => ["causer", "addr"],
756                         "causer-name" => ["causer", "name"],
757                         "causer-nick" => ["causer", "nick"],
758                         "causer-alias" => ["causer", "alias"],
759                         "causer-avatar" => ["causer", "thumb"],
760                         "causer-network" => ["causer", "network"],
761                         "causer-blocked" => ["causer", "blocked"],
762                         "causer-hidden" => ["causer", "hidden"],
763                         "causer-gsid" => ["causer", "gsid"],
764                         "causer-contact-type" => ["causer", "contact-type"],
765                         "question-id" => ["post-question", "id"],
766                         "question-multiple" => ["post-question", "multiple"],
767                         "question-voters" => ["post-question", "voters"],
768                         "question-end-time" => ["post-question", "end-time"],
769                         "has-categories" => "0",
770                         "has-media" => "EXISTS(SELECT `id` FROM `post-media` WHERE `post-media`.`uri-id` = `post-thread`.`uri-id`)",
771                         "total-comments" => "(SELECT COUNT(*) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
772                         "total-actors" => "(SELECT COUNT(DISTINCT(`author-id`)) FROM `post` WHERE `parent-uri-id` = `post-thread`.`uri-id` AND `gravity` = 6)",
773                         "signed_text" => ["diaspora-interaction", "interaction"],
774                         "parent-guid" => ["parent-item-uri", "guid"],
775                         "parent-network" => ["post-thread", "network"],
776                         "parent-author-id" => ["post-thread", "author-id"],
777                         "parent-author-link" => ["author", "url"],
778                         "parent-author-name" => ["author", "name"],
779                         "parent-author-nick" => ["author", "nick"],
780                         "parent-author-network" => ["author", "network"],
781                 ],
782                 "query" => "FROM `post-thread`
783                         INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
784                         STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
785                         STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
786                         LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
787                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
788                         LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
789                         LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
790                         LEFT JOIN `item-uri` AS `conversation-item-uri` ON `conversation-item-uri`.`id` = `post-thread`.`conversation-id`
791                         LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
792                         LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
793                         LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
794                         LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
795                         LEFT JOIN `item-uri` AS `quote-item-uri` ON `quote-item-uri`.`id` = `post-content`.`quote-uri-id`
796                         LEFT JOIN `post-question` ON `post-question`.`uri-id` = `post-thread`.`uri-id`"
797         ],
798         "category-view" => [
799                 "fields" => [
800                         "uri-id" => ["post-category", "uri-id"],
801                         "uid" => ["post-category", "uid"],
802                         "type" => ["post-category", "type"],
803                         "tid" => ["post-category", "tid"],
804                         "name" => ["tag", "name"],
805                         "url" => ["tag", "url"],
806                 ],
807                 "query" => "FROM `post-category`
808                         LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
809         ],
810         "collection-view" => [
811                 "fields" => [
812                         "uri-id" => ["post-collection", "uri-id"],
813                         "type" => ["post-collection", "type"],
814                         "cid" => ["post-collection", "author-id"],
815                         "received" => ["post", "received"],
816                         "created" => ["post", "created"],
817                         "commented" => ["post-thread", "commented"],
818                         "private" => ["post", "private"],
819                         "visible" => ["post", "visible"],
820                         "deleted" => ["post", "deleted"],
821                         "thr-parent-id" => ["post", "thr-parent-id"],
822                         "author-id" => ["post-collection", "author-id"],
823                         "gravity" => ["post", "gravity"],
824                 ],
825                 "query" => "FROM `post-collection`
826                         INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`
827                         INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`"
828         ],
829         "media-view" => [
830                 "fields" => [
831                         "uri-id" => ["post-media", "uri-id"],
832                         "type" => ["post-media", "type"],
833                         "received" => ["post", "received"],
834                         "created" => ["post", "created"],
835                         "private" => ["post", "private"],
836                         "visible" => ["post", "visible"],
837                         "deleted" => ["post", "deleted"],
838                         "thr-parent-id" => ["post", "thr-parent-id"],
839                         "author-id" => ["post", "author-id"],
840                         "gravity" => ["post", "gravity"],
841                 ],
842                 "query" => "FROM `post-media`
843                         INNER JOIN `post` ON `post-media`.`uri-id` = `post`.`uri-id`"
844         ],
845         "tag-view" => [
846                 "fields" => [
847                         "uri-id" => ["post-tag", "uri-id"],
848                         "type" => ["post-tag", "type"],
849                         "tid" => ["post-tag", "tid"],
850                         "cid" => ["post-tag", "cid"],
851                         "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
852                         "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
853                         "tag-type" => "CASE `cid` WHEN 0 THEN `tag`.`type` ELSE 1 END",
854                 ],
855                 "query" => "FROM `post-tag`
856                         LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
857                         LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
858         ],
859         "network-item-view" => [
860                 "fields" => [
861                         "uri-id" => ["post-user", "uri-id"],
862                         "parent" => ["post-thread-user", "post-user-id"],
863                         "received" => ["post-user", "received"],
864                         "commented" => ["post-thread-user", "commented"],
865                         "created" => ["post-user", "created"],
866                         "uid" => ["post-user", "uid"],
867                         "starred" => ["post-thread-user", "starred"],
868                         "mention" => ["post-thread-user", "mention"],
869                         "network" => ["post-user", "network"],
870                         "unseen" => ["post-user", "unseen"],
871                         "gravity" => ["post-user", "gravity"],
872                         "contact-id" => ["post-user", "contact-id"],
873                         "contact-type" => ["ownercontact", "contact-type"],
874                 ],
875                 "query" => "FROM `post-user`
876                         INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
877                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
878                         STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
879                         STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
880                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
881                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
882                         AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
883                         AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
884                         AND NOT EXISTS(SELECT `cid`    FROM `user-contact` WHERE `uid` = `post-thread-user`.`uid` AND `cid` IN (`authorcontact`.`id`, `ownercontact`.`id`) AND (`blocked` OR `ignored`))
885                         AND NOT EXISTS(SELECT `gsid`   FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`)"
886         ],
887         "network-thread-view" => [
888                 "fields" => [
889                         "uri-id" => ["post-thread-user", "uri-id"],
890                         "parent" => ["post-thread-user", "post-user-id"],
891                         "received" => ["post-thread-user", "received"],
892                         "commented" => ["post-thread-user", "commented"],
893                         "created" => ["post-thread-user", "created"],
894                         "uid" => ["post-thread-user", "uid"],
895                         "starred" => ["post-thread-user", "starred"],
896                         "mention" => ["post-thread-user", "mention"],
897                         "network" => ["post-thread-user", "network"],
898                         "contact-id" => ["post-thread-user", "contact-id"],
899                         "contact-type" => ["ownercontact", "contact-type"],
900                 ],
901                 "query" => "FROM `post-thread-user`
902                         INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
903                         STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
904                         STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
905                         STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
906                         WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
907                         AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
908                         AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
909                         AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
910                         AND NOT EXISTS(SELECT `cid`    FROM `user-contact` WHERE `uid` = `post-thread-user`.`uid` AND `cid` IN (`authorcontact`.`id`, `ownercontact`.`id`) AND (`blocked` OR `ignored`))
911                         AND NOT EXISTS(SELECT `gsid`   FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`)"
912         ],
913         "owner-view" => [
914                 "fields" => [
915                         "id" => ["contact", "id"],
916                         "uid" => ["contact", "uid"],
917                         "created" => ["contact", "created"],
918                         "updated" => ["contact", "updated"],
919                         "self" => ["contact", "self"],
920                         "remote_self" => ["contact", "remote_self"],
921                         "rel" => ["contact", "rel"],
922                         "network" => ["contact", "network"],
923                         "protocol" => ["contact", "protocol"],
924                         "name" => ["contact", "name"],
925                         "nick" => ["contact", "nick"],
926                         "location" => ["contact", "location"],
927                         "about" => ["contact", "about"],
928                         "keywords" => ["contact", "keywords"],
929                         "xmpp" => ["contact", "xmpp"],
930                         "matrix" => ["contact", "matrix"],
931                         "attag" => ["contact", "attag"],
932                         "avatar" => ["contact", "avatar"],
933                         "photo" => ["contact", "photo"],
934                         "thumb" => ["contact", "thumb"],
935                         "micro" => ["contact", "micro"],
936                         "header" => ["contact", "header"],
937                         "url" => ["contact", "url"],
938                         "nurl" => ["contact", "nurl"],
939                         "uri-id" => ["contact", "uri-id"],
940                         "addr" => ["contact", "addr"],
941                         "alias" => ["contact", "alias"],
942                         "pubkey" => ["contact", "pubkey"],
943                         "prvkey" => ["contact", "prvkey"],
944                         "batch" => ["contact", "batch"],
945                         "request" => ["contact", "request"],
946                         "notify" => ["contact", "notify"],
947                         "poll" => ["contact", "poll"],
948                         "confirm" => ["contact", "confirm"],
949                         "poco" => ["contact", "poco"],
950                         "subhub" => ["contact", "subhub"],
951                         "hub-verify" => ["contact", "hub-verify"],
952                         "last-update" => ["contact", "last-update"],
953                         "success_update" => ["contact", "success_update"],
954                         "failure_update" => ["contact", "failure_update"],
955                         "name-date" => ["contact", "name-date"],
956                         "uri-date" => ["contact", "uri-date"],
957                         "avatar-date" => ["contact", "avatar-date"],
958                         "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
959                         "term-date" => ["contact", "term-date"],
960                         "last-item" => ["contact", "last-item"],
961                         "priority" => ["contact", "priority"],
962                         "blocked" => ["user", "blocked"],
963                         "block_reason" => ["contact", "block_reason"],
964                         "readonly" => ["contact", "readonly"],
965                         "writable" => ["contact", "writable"],
966                         "forum" => ["contact", "forum"],
967                         "prv" => ["contact", "prv"],
968                         "contact-type" => ["contact", "contact-type"],
969                         "manually-approve" => ["contact", "manually-approve"],
970                         "hidden" => ["contact", "hidden"],
971                         "archive" => ["contact", "archive"],
972                         "pending" => ["contact", "pending"],
973                         "deleted" => ["contact", "deleted"],
974                         "unsearchable" => ["contact", "unsearchable"],
975                         "sensitive" => ["contact", "sensitive"],
976                         "baseurl" => ["contact", "baseurl"],
977                         "reason" => ["contact", "reason"],
978                         "info" => ["contact", "info"],
979                         "bdyear" => ["contact", "bdyear"],
980                         "bd" => ["contact", "bd"],
981                         "notify_new_posts" => ["contact", "notify_new_posts"],
982                         "fetch_further_information" => ["contact", "fetch_further_information"],
983                         "ffi_keyword_blacklist" => ["contact", "ffi_keyword_blacklist"],
984                         "parent-uid" => ["user", "parent-uid"],
985                         "guid" => ["user", "guid"],
986                         "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
987                         "email" => ["user", "email"],
988                         "openid" => ["user", "openid"],
989                         "timezone" => ["user", "timezone"],
990                         "language" => ["user", "language"],
991                         "register_date" => ["user", "register_date"],
992                         "login_date" => ["user", "login_date"],
993                         "last-activity" => ["user", "last-activity"],
994                         "default-location" => ["user", "default-location"],
995                         "allow_location" => ["user", "allow_location"],
996                         "theme" => ["user", "theme"],
997                         "upubkey" => ["user", "pubkey"],
998                         "uprvkey" => ["user", "prvkey"],
999                         "sprvkey" => ["user", "sprvkey"],
1000                         "spubkey" => ["user", "spubkey"],
1001                         "verified" => ["user", "verified"],
1002                         "blockwall" => ["user", "blockwall"],
1003                         "hidewall" => ["user", "hidewall"],
1004                         "blocktags" => ["user", "blocktags"],
1005                         "notify-flags" => ["user", "notify-flags"],
1006                         "page-flags" => ["user", "page-flags"],
1007                         "account-type" => ["user", "account-type"],
1008                         "prvnets" => ["user", "prvnets"],
1009                         "maxreq" => ["user", "maxreq"],
1010                         "expire" => ["user", "expire"],
1011                         "account_removed" => ["user", "account_removed"],
1012                         "account_expired" => ["user", "account_expired"],
1013                         "account_expires_on" => ["user", "account_expires_on"],
1014                         "expire_notification_sent" => ["user", "expire_notification_sent"],
1015                         "def_gid" => ["user", "def_gid"],
1016                         "allow_cid" => ["user", "allow_cid"],
1017                         "allow_gid" => ["user", "allow_gid"],
1018                         "deny_cid" => ["user", "deny_cid"],
1019                         "deny_gid" => ["user", "deny_gid"],
1020                         "openidserver" => ["user", "openidserver"],
1021                         "publish" => ["profile", "publish"],
1022                         "net-publish" => ["profile", "net-publish"],
1023                         "hide-friends" => ["profile", "hide-friends"],
1024                         "prv_keywords" => ["profile", "prv_keywords"],
1025                         "pub_keywords" => ["profile", "pub_keywords"],
1026                         "address" => ["profile", "address"],
1027                         "locality" => ["profile", "locality"],
1028                         "region" => ["profile", "region"],
1029                         "postal-code" => ["profile", "postal-code"],
1030                         "country-name" => ["profile", "country-name"],
1031                         "homepage" => ["profile", "homepage"],
1032                         "homepage_verified" => ["profile", "homepage_verified"],
1033                         "dob" => ["profile", "dob"],
1034                 ],
1035                 "query" => "FROM `user`
1036                         INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
1037                         INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
1038         ],
1039         "account-view" => [
1040                 "fields" => [
1041                         "id" => ["contact", "id"],
1042                         "url" => ["contact", "url"],
1043                         "nurl" => ["contact", "nurl"],
1044                         "uri-id" => ["contact", "uri-id"],
1045                         "guid" => ["item-uri", "guid"],
1046                         "addr" => ["contact", "addr"],
1047                         "alias" => ["contact", "alias"],
1048                         "name" => ["contact", "name"],
1049                         "nick" => ["contact", "nick"],
1050                         "about" => ["contact", "about"],
1051                         "keywords" => ["contact", "keywords"],
1052                         "xmpp" => ["contact", "xmpp"],
1053                         "matrix" => ["contact", "matrix"],
1054                         "avatar" => ["contact", "avatar"],
1055                         "photo" => ["contact", "photo"],
1056                         "thumb" => ["contact", "thumb"],
1057                         "micro" => ["contact", "micro"],
1058                         "header" => ["contact", "header"],
1059                         "created" => ["contact", "created"],
1060                         "updated" => ["contact", "updated"],
1061                         "network" => ["contact", "network"],
1062                         "protocol" => ["contact", "protocol"],
1063                         "location" => ["contact", "location"],
1064                         "attag" => ["contact", "attag"],
1065                         "pubkey" => ["contact", "pubkey"],
1066                         "prvkey" => ["contact", "prvkey"],
1067                         "subscribe" => ["contact", "subscribe"],
1068                         "last-update" => ["contact", "last-update"],
1069                         "success_update" => ["contact", "success_update"],
1070                         "failure_update" => ["contact", "failure_update"],
1071                         "failed" => ["contact", "failed"],
1072                         "last-item" => ["contact", "last-item"],
1073                         "last-discovery" => ["contact", "last-discovery"],
1074                         "contact-type" => ["contact", "contact-type"],
1075                         "manually-approve" => ["contact", "manually-approve"],
1076                         "unsearchable" => ["contact", "unsearchable"],
1077                         "sensitive" => ["contact", "sensitive"],
1078                         "baseurl" => ["contact", "baseurl"],
1079                         "gsid" => ["contact", "gsid"],
1080                         "info" => ["contact", "info"],
1081                         "bdyear" => ["contact", "bdyear"],
1082                         "bd" => ["contact", "bd"],
1083                         "poco" => ["contact", "poco"],
1084                         "name-date" => ["contact", "name-date"],
1085                         "uri-date" => ["contact", "uri-date"],
1086                         "avatar-date" => ["contact", "avatar-date"],
1087                         "term-date" => ["contact", "term-date"],
1088                         "global-ignored" => ["contact", "hidden"],
1089                         "global-blocked" => ["contact", "blocked"],
1090                         "hidden" => ["contact", "hidden"],
1091                         "archive" => ["contact", "archive"],
1092                         "deleted" => ["contact", "deleted"],
1093                         "blocked" => ["contact", "blocked"],
1094                         "dfrn-notify" => ["contact", "notify"],
1095                         "dfrn-poll" => ["contact", "poll"],
1096                         "diaspora-guid" => ["item-uri", "guid"],
1097                         "diaspora-batch" => ["diaspora-contact", "batch"],
1098                         "diaspora-notify" => ["diaspora-contact", "notify"],
1099                         "diaspora-poll" => ["diaspora-contact", "poll"],
1100                         "diaspora-alias" => ["diaspora-contact", "alias"],
1101                         "ap-uuid" => ["apcontact", "uuid"],
1102                         "ap-type" => ["apcontact", "type"],
1103                         "ap-following" => ["apcontact", "following"],
1104                         "ap-followers" => ["apcontact", "followers"],
1105                         "ap-inbox" => ["apcontact", "inbox"],
1106                         "ap-outbox" => ["apcontact", "outbox"],
1107                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1108                         "ap-generator" => ["apcontact", "generator"],
1109                         "ap-following_count" => ["apcontact", "following_count"],
1110                         "ap-followers_count" => ["apcontact", "followers_count"],
1111                         "ap-statuses_count" => ["apcontact", "statuses_count"],
1112                         "site_name" => ["gserver", "site_name"],
1113                         "platform" => ["gserver", "platform"],
1114                         "version" => ["gserver", "version"],
1115                         "server-blocked" => ["gserver", "blocked"],
1116                         "server-failed" => ["gserver", "failed"],
1117                 ],
1118                 "query" => "FROM `contact`
1119                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
1120                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
1121                         LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = contact.`uri-id`
1122                         LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
1123                         WHERE `contact`.`uid` = 0"
1124         ],
1125         "account-user-view" => [
1126                 "fields" => [
1127                         "id" => ["ucontact", "id"],
1128                         "pid" => ["contact", "id"],
1129                         "uid" => ["ucontact", "uid"],
1130                         "url" => ["contact", "url"],
1131                         "nurl" => ["contact", "nurl"],
1132                         "uri-id" => ["contact", "uri-id"],
1133                         "guid" => ["item-uri", "guid"],
1134                         "addr" => ["contact", "addr"],
1135                         "alias" => ["contact", "alias"],
1136                         "name" => ["contact", "name"],
1137                         "nick" => ["contact", "nick"],
1138                         "about" => ["contact", "about"],
1139                         "keywords" => ["contact", "keywords"],
1140                         "xmpp" => ["contact", "xmpp"],
1141                         "matrix" => ["contact", "matrix"],
1142                         "avatar" => ["contact", "avatar"],
1143                         "photo" => ["contact", "photo"],
1144                         "thumb" => ["contact", "thumb"],
1145                         "micro" => ["contact", "micro"],
1146                         "header" => ["contact", "header"],
1147                         "created" => ["contact", "created"],
1148                         "updated" => ["contact", "updated"],
1149                         "self" => ["ucontact", "self"],
1150                         "remote_self" => ["ucontact", "remote_self"],
1151                         "rel" =>  ["ucontact", "rel"],
1152                         "network" => ["contact", "network"],
1153                         "protocol" => ["ucontact", "protocol"],
1154                         "location" => ["contact", "location"],
1155                         "attag" => ["ucontact", "attag"],
1156                         "pubkey" => ["contact", "pubkey"],
1157                         "prvkey" => ["contact", "prvkey"],
1158                         "subscribe" => ["contact", "subscribe"],
1159                         "last-update" => ["contact", "last-update"],
1160                         "success_update" => ["contact", "success_update"],
1161                         "failure_update" => ["contact", "failure_update"],
1162                         "failed" => ["contact", "failed"],
1163                         "last-item" => ["contact", "last-item"],
1164                         "last-discovery" => ["contact", "last-discovery"],
1165                         "contact-type" => ["contact", "contact-type"],
1166                         "manually-approve" => ["contact", "manually-approve"],
1167                         "unsearchable" => ["contact", "unsearchable"],
1168                         "sensitive" => ["contact", "sensitive"],
1169                         "baseurl" => ["contact", "baseurl"],
1170                         "gsid" => ["contact", "gsid"],
1171                         "info" => ["ucontact", "info"],
1172                         "bdyear" => ["contact", "bdyear"],
1173                         "bd" => ["contact", "bd"],
1174                         "poco" => ["contact", "poco"],
1175                         "name-date" => ["contact", "name-date"],
1176                         "uri-date" => ["contact", "uri-date"],
1177                         "avatar-date" => ["contact", "avatar-date"],
1178                         "term-date" => ["contact", "term-date"],
1179                         "global-ignored" => ["contact", "hidden"],
1180                         "global-blocked" => ["contact", "blocked"],
1181                         "hidden" => ["ucontact", "hidden"],
1182                         "archive" => ["ucontact", "archive"],
1183                         "pending" => ["ucontact", "pending"],
1184                         "deleted" => ["ucontact", "deleted"],
1185                         "notify_new_posts" => ["ucontact", "notify_new_posts"],
1186                         "fetch_further_information" => ["ucontact", "fetch_further_information"],
1187                         "ffi_keyword_blacklist" => ["ucontact", "ffi_keyword_blacklist"],
1188                         "rating" => ["ucontact", "rating"],
1189                         "readonly" => ["ucontact", "readonly"],
1190                         "blocked" => ["ucontact", "blocked"],
1191                         "block_reason" => ["ucontact", "block_reason"],
1192                         "subhub" => ["ucontact", "subhub"],
1193                         "hub-verify" => ["ucontact", "hub-verify"],
1194                         "reason" => ["ucontact", "reason"],
1195                         "dfrn-notify" => ["contact", "notify"],
1196                         "dfrn-poll" => ["contact", "poll"],
1197                         "diaspora-guid" => ["item-uri", "guid"],
1198                         "diaspora-batch" => ["diaspora-contact", "batch"],
1199                         "diaspora-notify" => ["diaspora-contact", "notify"],
1200                         "diaspora-poll" => ["diaspora-contact", "poll"],
1201                         "diaspora-alias" => ["diaspora-contact", "alias"],
1202                         "diaspora-interacting_count" => ["diaspora-contact", "interacting_count"],
1203                         "diaspora-interacted_count" => ["diaspora-contact", "interacted_count"],
1204                         "diaspora-post_count" => ["diaspora-contact", "post_count"],
1205                         "ap-uuid" => ["apcontact", "uuid"],
1206                         "ap-type" => ["apcontact", "type"],
1207                         "ap-following" => ["apcontact", "following"],
1208                         "ap-followers" => ["apcontact", "followers"],
1209                         "ap-inbox" => ["apcontact", "inbox"],
1210                         "ap-outbox" => ["apcontact", "outbox"],
1211                         "ap-sharedinbox" => ["apcontact", "sharedinbox"],
1212                         "ap-generator" => ["apcontact", "generator"],
1213                         "ap-following_count" => ["apcontact", "following_count"],
1214                         "ap-followers_count" => ["apcontact", "followers_count"],
1215                         "ap-statuses_count" => ["apcontact", "statuses_count"],
1216                         "site_name" => ["gserver", "site_name"],
1217                         "platform" => ["gserver", "platform"],
1218                         "version" => ["gserver", "version"],
1219                         "server-blocked" => ["gserver", "blocked"],
1220                         "server-failed" => ["gserver", "failed"],
1221                 ],
1222                 "query" => "FROM `contact` AS `ucontact`
1223                         INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
1224                         LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
1225                         LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
1226                         LEFT JOIN `diaspora-contact` ON `diaspora-contact`.`uri-id` = `ucontact`.`uri-id`
1227                         LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`"
1228         ],
1229         "pending-view" => [
1230                 "fields" => [
1231                         "id" => ["register", "id"],
1232                         "hash" => ["register", "hash"],
1233                         "created" => ["register", "created"],
1234                         "uid" => ["register", "uid"],
1235                         "password" => ["register", "password"],
1236                         "language" => ["register", "language"],
1237                         "note" => ["register", "note"],
1238                         "self" => ["contact", "self"],
1239                         "name" => ["contact", "name"],
1240                         "url" => ["contact", "url"],
1241                         "micro" => ["contact", "micro"],
1242                         "email" => ["user", "email"],
1243                         "nick" => ["contact", "nick"],
1244                 ],
1245                 "query" => "FROM `register`
1246                         INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1247                         INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
1248         ],
1249         "tag-search-view" => [
1250                 "fields" => [
1251                         "uri-id" => ["post-tag", "uri-id"],
1252                         "uid" => ["post-user", "uid"],
1253                         "iid" => ["post-user", "id"],
1254                         "private" => ["post-user", "private"],
1255                         "wall" => ["post-user", "wall"],
1256                         "origin" => ["post-user", "origin"],
1257                         "global" => ["post-user", "global"],
1258                         "gravity" => ["post-user", "gravity"],
1259                         "received" => ["post-user", "received"],
1260                         "network" => ["post-user", "network"],
1261                         "author-id" => ["post-user", "author-id"],
1262                         "name" => ["tag", "name"],
1263                 ],
1264                 "query" => "FROM `post-tag`
1265                         INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1266                         STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
1267                         WHERE `post-tag`.`type` = 1"
1268         ],
1269         "workerqueue-view" => [
1270                 "fields" => [
1271                         "pid" => ["process", "pid"],
1272                         "priority" => ["workerqueue", "priority"],
1273                 ],
1274                 "query" => "FROM `process`
1275                         INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1276                         WHERE NOT `workerqueue`.`done`"
1277         ],
1278         "profile_field-view" => [
1279                 "fields" => [
1280                         "id" => ["profile_field", "id"],
1281                         "uid" => ["profile_field", "uid"],
1282                         "label" => ["profile_field", "label"],
1283                         "value" => ["profile_field", "value"],
1284                         "order" => ["profile_field", "order"],
1285                         "psid"=> ["profile_field", "psid"],
1286                         "allow_cid" => ["permissionset", "allow_cid"],
1287                         "allow_gid" => ["permissionset", "allow_gid"],
1288                         "deny_cid" => ["permissionset", "deny_cid"],
1289                         "deny_gid" => ["permissionset", "deny_gid"],
1290                         "created" => ["profile_field", "created"],
1291                         "edited" => ["profile_field", "edited"],
1292                 ],
1293                 "query" => "FROM `profile_field`
1294                         INNER JOIN `permissionset` ON `permissionset`.`id` = `profile_field`.`psid`"
1295         ],
1296         "diaspora-contact-view" => [
1297                 "fields" => [
1298                         "uri-id" => ["diaspora-contact", "uri-id"],
1299                         "url" => ["item-uri", "uri"],
1300                         "guid" => ["item-uri", "guid"],
1301                         "addr" => ["diaspora-contact", "addr"],
1302                         "alias" => ["diaspora-contact", "alias"],
1303                         "nick" => ["diaspora-contact", "nick"],
1304                         "name" => ["diaspora-contact", "name"],
1305                         "given-name" => ["diaspora-contact", "given-name"],
1306                         "family-name" => ["diaspora-contact", "family-name"],
1307                         "photo" => ["diaspora-contact", "photo"],
1308                         "photo-medium" => ["diaspora-contact", "photo-medium"],
1309                         "photo-small" => ["diaspora-contact", "photo-small"],
1310                         "batch" => ["diaspora-contact", "batch"],
1311                         "notify" => ["diaspora-contact", "notify"],
1312                         "poll" => ["diaspora-contact", "poll"],
1313                         "subscribe" => ["diaspora-contact", "subscribe"],
1314                         "searchable" => ["diaspora-contact", "searchable"],
1315                         "pubkey" => ["diaspora-contact", "pubkey"],
1316                         "baseurl" => ["gserver", "url"],
1317                         "gsid" => ["diaspora-contact", "gsid"],
1318                         "created" => ["diaspora-contact", "created"],
1319                         "updated" => ["diaspora-contact", "updated"],
1320                         "interacting_count" => ["diaspora-contact", "interacting_count"],
1321                         "interacted_count" => ["diaspora-contact", "interacted_count"],
1322                         "post_count" => ["diaspora-contact", "post_count"],
1323                 ],
1324                 "query" => "FROM `diaspora-contact`
1325                         INNER JOIN `item-uri` ON `item-uri`.`id` = `diaspora-contact`.`uri-id`
1326                         LEFT JOIN `gserver` ON `gserver`.`id` = `diaspora-contact`.`gsid`"
1327         ],
1328 ];