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