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