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