3 * @copyright Copyright (C) 2010-2021, the Friendica project
5 * @license GNU AGPL version 3 or any later version
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.
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.
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/>.
20 * Main view structure configuration file.
22 * Here are described all the view Friendica needs to work.
24 * Syntax (braces indicate optionale values):
27 * "<field name>" => ["table", "field"],
28 * "<field name>" => "SQL expression",
31 * "query" => "FROM `table` INNER JOIN `other-table` ..."
35 * If you need to make any change, make sure to increment the DB_UPDATE_VERSION constant value in dbstructure.config.php.
40 "application-view" => [
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"],
58 "query" => "FROM `application-token`
59 INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`"
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 "dfrn-id" => ["contact", "dfrn-id"],
142 "author-id" => ["post-user", "author-id"],
143 "author-link" => ["author", "url"],
144 "author-addr" => ["author", "addr"],
145 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
146 "author-nick" => ["author", "nick"],
147 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
148 "author-network" => ["author", "network"],
149 "author-blocked" => ["author", "blocked"],
150 "author-hidden" => ["author", "hidden"],
151 "owner-id" => ["post-user", "owner-id"],
152 "owner-link" => ["owner", "url"],
153 "owner-addr" => ["owner", "addr"],
154 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
155 "owner-nick" => ["owner", "nick"],
156 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
157 "owner-network" => ["owner", "network"],
158 "owner-blocked" => ["owner", "blocked"],
159 "owner-hidden" => ["owner", "hidden"],
160 "owner-contact-type" => ["owner", "contact-type"],
161 "causer-id" => ["post-user", "causer-id"],
162 "causer-link" => ["causer", "url"],
163 "causer-addr" => ["causer", "addr"],
164 "causer-name" => ["causer", "name"],
165 "causer-nick" => ["causer", "nick"],
166 "causer-avatar" => ["causer", "thumb"],
167 "causer-network" => ["causer", "network"],
168 "causer-blocked" => ["causer", "blocked"],
169 "causer-hidden" => ["causer", "hidden"],
170 "causer-contact-type" => ["causer", "contact-type"],
171 "postopts" => ["post-delivery-data", "postopts"],
172 "inform" => ["post-delivery-data", "inform"],
173 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
174 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
175 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
176 "allow_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
177 "allow_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
178 "deny_cid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
179 "deny_gid" => "IF (`post-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
180 "event-id" => ["post-user", "event-id"],
181 "event-created" => ["event", "created"],
182 "event-edited" => ["event", "edited"],
183 "event-start" => ["event", "start"],
184 "event-finish" => ["event", "finish"],
185 "event-summary" => ["event", "summary"],
186 "event-desc" => ["event", "desc"],
187 "event-location" => ["event", "location"],
188 "event-type" => ["event", "type"],
189 "event-nofinish" => ["event", "nofinish"],
190 "event-adjust" => ["event", "adjust"],
191 "event-ignore" => ["event", "ignore"],
192 "signed_text" => ["diaspora-interaction", "interaction"],
193 "parent-guid" => ["parent-item-uri", "guid"],
194 "parent-network" => ["parent-post", "network"],
195 "parent-author-id" => ["parent-post", "author-id"],
196 "parent-author-link" => ["parent-post-author", "url"],
197 "parent-author-name" => ["parent-post-author", "name"],
198 "parent-author-network" => ["parent-post-author", "network"],
199 "parent-author-blocked" => ["parent-post-author", "blocked"],
200 "parent-author-hidden" => ["parent-post-author", "hidden"],
202 "query" => "FROM `post-user`
203 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
204 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
205 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
206 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
207 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`
208 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-user`.`uri-id`
209 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
210 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
211 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
212 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
213 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
214 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-user`.`uri-id`
215 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-user`.`uri-id`
216 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-user`.`uri-id` AND `post-user`.`origin`
217 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-user`.`psid`
218 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
219 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
221 "post-thread-user-view" => [
223 "id" => ["post-user", "id"],
224 "post-user-id" => ["post-user", "id"],
225 "uid" => ["post-thread-user", "uid"],
226 "parent" => ["parent-post", "id"],
227 "uri" => ["item-uri", "uri"],
228 "uri-id" => ["post-thread-user", "uri-id"],
229 "parent-uri" => ["parent-item-uri", "uri"],
230 "parent-uri-id" => ["post-user", "parent-uri-id"],
231 "thr-parent" => ["thr-parent-item-uri", "uri"],
232 "thr-parent-id" => ["post-user", "thr-parent-id"],
233 "guid" => ["item-uri", "guid"],
234 "wall" => ["post-thread-user", "wall"],
235 "gravity" => ["post-user", "gravity"],
236 "extid" => ["external-item-uri", "uri"],
237 "external-id" => ["post-user", "external-id"],
238 "created" => ["post-thread-user", "created"],
239 "edited" => ["post-user", "edited"],
240 "commented" => ["post-thread-user", "commented"],
241 "received" => ["post-thread-user", "received"],
242 "changed" => ["post-thread-user", "changed"],
243 "post-type" => ["post-user", "post-type"],
244 "post-reason" => ["post-user", "post-reason"],
245 "private" => ["post-user", "private"],
246 "pubmail" => ["post-thread-user", "pubmail"],
247 "ignored" => ["post-thread-user", "ignored"],
248 "visible" => ["post-user", "visible"],
249 "starred" => ["post-thread-user", "starred"],
250 "pinned" => ["post-thread-user", "pinned"],
251 "unseen" => ["post-thread-user", "unseen"],
252 "deleted" => ["post-user", "deleted"],
253 "origin" => ["post-thread-user", "origin"],
254 "forum_mode" => ["post-thread-user", "forum_mode"],
255 "mention" => ["post-thread-user", "mention"],
256 "global" => ["post-user", "global"],
257 "network" => ["post-thread-user", "network"],
258 "vid" => ["post-user", "vid"],
259 "psid" => ["post-thread-user", "psid"],
260 "verb" => "IF (`post-user`.`vid` IS NULL, '', `verb`.`name`)",
261 "title" => ["post-content", "title"],
262 "content-warning" => ["post-content", "content-warning"],
263 "raw-body" => ["post-content", "raw-body"],
264 "body" => ["post-content", "body"],
265 "rendered-hash" => ["post-content", "rendered-hash"],
266 "rendered-html" => ["post-content", "rendered-html"],
267 "language" => ["post-content", "language"],
268 "plink" => ["post-content", "plink"],
269 "location" => ["post-content", "location"],
270 "coord" => ["post-content", "coord"],
271 "app" => ["post-content", "app"],
272 "object-type" => ["post-content", "object-type"],
273 "object" => ["post-content", "object"],
274 "target-type" => ["post-content", "target-type"],
275 "target" => ["post-content", "target"],
276 "resource-id" => ["post-content", "resource-id"],
277 "contact-id" => ["post-thread-user", "contact-id"],
278 "contact-link" => ["contact", "url"],
279 "contact-addr" => ["contact", "addr"],
280 "contact-name" => ["contact", "name"],
281 "contact-nick" => ["contact", "nick"],
282 "contact-avatar" => ["contact", "thumb"],
283 "contact-network" => ["contact", "network"],
284 "contact-blocked" => ["contact", "blocked"],
285 "contact-hidden" => ["contact", "hidden"],
286 "contact-readonly" => ["contact", "readonly"],
287 "contact-archive" => ["contact", "archive"],
288 "contact-pending" => ["contact", "pending"],
289 "contact-rel" => ["contact", "rel"],
290 "contact-uid" => ["contact", "uid"],
291 "contact-contact-type" => ["contact", "contact-type"],
292 "writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
293 "self" => ["contact", "self"],
294 "cid" => ["contact", "id"],
295 "alias" => ["contact", "alias"],
296 "photo" => ["contact", "photo"],
297 "name-date" => ["contact", "name-date"],
298 "uri-date" => ["contact", "uri-date"],
299 "avatar-date" => ["contact", "avatar-date"],
300 "thumb" => ["contact", "thumb"],
301 "dfrn-id" => ["contact", "dfrn-id"],
302 "author-id" => ["post-thread-user", "author-id"],
303 "author-link" => ["author", "url"],
304 "author-addr" => ["author", "addr"],
305 "author-name" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`name` != '', `contact`.`name`, `author`.`name`)",
306 "author-nick" => ["author", "nick"],
307 "author-avatar" => "IF (`contact`.`url` = `author`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `author`.`thumb`)",
308 "author-network" => ["author", "network"],
309 "author-blocked" => ["author", "blocked"],
310 "author-hidden" => ["author", "hidden"],
311 "owner-id" => ["post-thread-user", "owner-id"],
312 "owner-link" => ["owner", "url"],
313 "owner-addr" => ["owner", "addr"],
314 "owner-name" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`name` != '', `contact`.`name`, `owner`.`name`)",
315 "owner-nick" => ["owner", "nick"],
316 "owner-avatar" => "IF (`contact`.`url` = `owner`.`url` AND `contact`.`thumb` != '', `contact`.`thumb`, `owner`.`thumb`)",
317 "owner-network" => ["owner", "network"],
318 "owner-blocked" => ["owner", "blocked"],
319 "owner-hidden" => ["owner", "hidden"],
320 "owner-contact-type" => ["owner", "contact-type"],
321 "causer-id" => ["post-thread-user", "causer-id"],
322 "causer-link" => ["causer", "url"],
323 "causer-addr" => ["causer", "addr"],
324 "causer-name" => ["causer", "name"],
325 "causer-nick" => ["causer", "nick"],
326 "causer-avatar" => ["causer", "thumb"],
327 "causer-network" => ["causer", "network"],
328 "causer-blocked" => ["causer", "blocked"],
329 "causer-hidden" => ["causer", "hidden"],
330 "causer-contact-type" => ["causer", "contact-type"],
331 "postopts" => ["post-delivery-data", "postopts"],
332 "inform" => ["post-delivery-data", "inform"],
333 "delivery_queue_count" => ["post-delivery-data", "queue_count"],
334 "delivery_queue_done" => ["post-delivery-data", "queue_done"],
335 "delivery_queue_failed" => ["post-delivery-data", "queue_failed"],
336 "allow_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_cid`)",
337 "allow_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`allow_gid`)",
338 "deny_cid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_cid`)",
339 "deny_gid" => "IF (`post-thread-user`.`psid` IS NULL, '', `permissionset`.`deny_gid`)",
340 "event-id" => ["post-user", "event-id"],
341 "event-created" => ["event", "created"],
342 "event-edited" => ["event", "edited"],
343 "event-start" => ["event", "start"],
344 "event-finish" => ["event", "finish"],
345 "event-summary" => ["event", "summary"],
346 "event-desc" => ["event", "desc"],
347 "event-location" => ["event", "location"],
348 "event-type" => ["event", "type"],
349 "event-nofinish" => ["event", "nofinish"],
350 "event-adjust" => ["event", "adjust"],
351 "event-ignore" => ["event", "ignore"],
352 "signed_text" => ["diaspora-interaction", "interaction"],
353 "parent-guid" => ["parent-item-uri", "guid"],
354 "parent-network" => ["parent-post", "network"],
355 "parent-author-id" => ["parent-post", "author-id"],
356 "parent-author-link" => ["parent-post-author", "url"],
357 "parent-author-name" => ["parent-post-author", "name"],
358 "parent-author-network" => ["parent-post-author", "network"],
359 "parent-author-blocked" => ["parent-post-author", "blocked"],
360 "parent-author-hidden" => ["parent-post-author", "hidden"],
362 "query" => "FROM `post-thread-user`
363 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
364 STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
365 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread-user`.`author-id`
366 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread-user`.`owner-id`
367 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread-user`.`causer-id`
368 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread-user`.`uri-id`
369 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post-user`.`thr-parent-id`
370 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post-user`.`parent-uri-id`
371 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post-user`.`external-id`
372 LEFT JOIN `verb` ON `verb`.`id` = `post-user`.`vid`
373 LEFT JOIN `event` ON `event`.`id` = `post-user`.`event-id`
374 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread-user`.`uri-id`
375 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread-user`.`uri-id`
376 LEFT JOIN `post-delivery-data` ON `post-delivery-data`.`uri-id` = `post-thread-user`.`uri-id` AND `post-thread-user`.`origin`
377 LEFT JOIN `permissionset` ON `permissionset`.`id` = `post-thread-user`.`psid`
378 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`
379 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
383 "uri" => ["item-uri", "uri"],
384 "uri-id" => ["post", "uri-id"],
385 "parent-uri" => ["parent-item-uri", "uri"],
386 "parent-uri-id" => ["post", "parent-uri-id"],
387 "thr-parent" => ["thr-parent-item-uri", "uri"],
388 "thr-parent-id" => ["post", "thr-parent-id"],
389 "guid" => ["item-uri", "guid"],
390 "gravity" => ["post", "gravity"],
391 "extid" => ["external-item-uri", "uri"],
392 "external-id" => ["post", "external-id"],
393 "created" => ["post", "created"],
394 "edited" => ["post", "edited"],
395 "commented" => ["post-thread", "commented"],
396 "received" => ["post", "received"],
397 "changed" => ["post-thread", "changed"],
398 "post-type" => ["post", "post-type"],
399 "private" => ["post", "private"],
400 "visible" => ["post", "visible"],
401 "deleted" => ["post", "deleted"],
402 "global" => ["post", "global"],
403 "network" => ["post", "network"],
404 "vid" => ["post", "vid"],
405 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
406 "title" => ["post-content", "title"],
407 "content-warning" => ["post-content", "content-warning"],
408 "raw-body" => ["post-content", "raw-body"],
409 "body" => ["post-content", "body"],
410 "rendered-hash" => ["post-content", "rendered-hash"],
411 "rendered-html" => ["post-content", "rendered-html"],
412 "language" => ["post-content", "language"],
413 "plink" => ["post-content", "plink"],
414 "location" => ["post-content", "location"],
415 "coord" => ["post-content", "coord"],
416 "app" => ["post-content", "app"],
417 "object-type" => ["post-content", "object-type"],
418 "object" => ["post-content", "object"],
419 "target-type" => ["post-content", "target-type"],
420 "target" => ["post-content", "target"],
421 "resource-id" => ["post-content", "resource-id"],
422 "contact-id" => ["post", "author-id"],
423 "contact-link" => ["author", "url"],
424 "contact-addr" => ["author", "addr"],
425 "contact-name" => ["author", "name"],
426 "contact-nick" => ["author", "nick"],
427 "contact-avatar" => ["author", "thumb"],
428 "contact-network" => ["author", "network"],
429 "contact-blocked" => ["author", "blocked"],
430 "contact-hidden" => ["author", "hidden"],
431 "contact-readonly" => ["author", "readonly"],
432 "contact-archive" => ["author", "archive"],
433 "contact-pending" => ["author", "pending"],
434 "contact-rel" => ["author", "rel"],
435 "contact-uid" => ["author", "uid"],
436 "contact-contact-type" => ["author", "contact-type"],
437 "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
439 "cid" => ["author", "id"],
440 "alias" => ["author", "alias"],
441 "photo" => ["author", "photo"],
442 "name-date" => ["author", "name-date"],
443 "uri-date" => ["author", "uri-date"],
444 "avatar-date" => ["author", "avatar-date"],
445 "thumb" => ["author", "thumb"],
446 "dfrn-id" => ["author", "dfrn-id"],
447 "author-id" => ["post", "author-id"],
448 "author-link" => ["author", "url"],
449 "author-addr" => ["author", "addr"],
450 "author-name" => ["author", "name"],
451 "author-nick" => ["author", "nick"],
452 "author-avatar" => ["author", "thumb"],
453 "author-network" => ["author", "network"],
454 "author-blocked" => ["author", "blocked"],
455 "author-hidden" => ["author", "hidden"],
456 "owner-id" => ["post", "owner-id"],
457 "owner-link" => ["owner", "url"],
458 "owner-addr" => ["owner", "addr"],
459 "owner-name" => ["owner", "name"],
460 "owner-nick" => ["owner", "nick"],
461 "owner-avatar" => ["owner", "thumb"],
462 "owner-network" => ["owner", "network"],
463 "owner-blocked" => ["owner", "blocked"],
464 "owner-hidden" => ["owner", "hidden"],
465 "owner-contact-type" => ["owner", "contact-type"],
466 "causer-id" => ["post", "causer-id"],
467 "causer-link" => ["causer", "url"],
468 "causer-addr" => ["causer", "addr"],
469 "causer-name" => ["causer", "name"],
470 "causer-nick" => ["causer", "nick"],
471 "causer-avatar" => ["causer", "thumb"],
472 "causer-network" => ["causer", "network"],
473 "causer-blocked" => ["causer", "blocked"],
474 "causer-hidden" => ["causer", "hidden"],
475 "causer-contact-type" => ["causer", "contact-type"],
476 "signed_text" => ["diaspora-interaction", "interaction"],
477 "parent-guid" => ["parent-item-uri", "guid"],
478 "parent-network" => ["parent-post", "network"],
479 "parent-author-id" => ["parent-post", "author-id"],
480 "parent-author-link" => ["parent-post-author", "url"],
481 "parent-author-name" => ["parent-post-author", "name"],
482 "parent-author-network" => ["parent-post-author", "network"],
483 "parent-author-blocked" => ["parent-post-author", "blocked"],
484 "parent-author-hidden" => ["parent-post-author", "hidden"],
486 "query" => "FROM `post`
487 STRAIGHT_JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`
488 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post`.`author-id`
489 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post`.`owner-id`
490 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post`.`causer-id`
491 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post`.`uri-id`
492 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
493 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
494 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
495 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
496 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post`.`uri-id`
497 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post`.`uri-id`
498 LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
499 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
501 "post-thread-view" => [
503 "uri" => ["item-uri", "uri"],
504 "uri-id" => ["post-thread", "uri-id"],
505 "parent-uri" => ["parent-item-uri", "uri"],
506 "parent-uri-id" => ["post", "parent-uri-id"],
507 "thr-parent" => ["thr-parent-item-uri", "uri"],
508 "thr-parent-id" => ["post", "thr-parent-id"],
509 "guid" => ["item-uri", "guid"],
510 "gravity" => ["post", "gravity"],
511 "extid" => ["external-item-uri", "uri"],
512 "external-id" => ["post", "external-id"],
513 "created" => ["post-thread", "created"],
514 "edited" => ["post", "edited"],
515 "commented" => ["post-thread", "commented"],
516 "received" => ["post-thread", "received"],
517 "changed" => ["post-thread", "changed"],
518 "post-type" => ["post", "post-type"],
519 "private" => ["post", "private"],
520 "visible" => ["post", "visible"],
521 "deleted" => ["post", "deleted"],
522 "global" => ["post", "global"],
523 "network" => ["post-thread", "network"],
524 "vid" => ["post", "vid"],
525 "verb" => "IF (`post`.`vid` IS NULL, '', `verb`.`name`)",
526 "title" => ["post-content", "title"],
527 "content-warning" => ["post-content", "content-warning"],
528 "raw-body" => ["post-content", "raw-body"],
529 "body" => ["post-content", "body"],
530 "rendered-hash" => ["post-content", "rendered-hash"],
531 "rendered-html" => ["post-content", "rendered-html"],
532 "language" => ["post-content", "language"],
533 "plink" => ["post-content", "plink"],
534 "location" => ["post-content", "location"],
535 "coord" => ["post-content", "coord"],
536 "app" => ["post-content", "app"],
537 "object-type" => ["post-content", "object-type"],
538 "object" => ["post-content", "object"],
539 "target-type" => ["post-content", "target-type"],
540 "target" => ["post-content", "target"],
541 "resource-id" => ["post-content", "resource-id"],
542 "contact-id" => ["post-thread", "author-id"],
543 "contact-link" => ["author", "url"],
544 "contact-addr" => ["author", "addr"],
545 "contact-name" => ["author", "name"],
546 "contact-nick" => ["author", "nick"],
547 "contact-avatar" => ["author", "thumb"],
548 "contact-network" => ["author", "network"],
549 "contact-blocked" => ["author", "blocked"],
550 "contact-hidden" => ["author", "hidden"],
551 "contact-readonly" => ["author", "readonly"],
552 "contact-archive" => ["author", "archive"],
553 "contact-pending" => ["author", "pending"],
554 "contact-rel" => ["author", "rel"],
555 "contact-uid" => ["author", "uid"],
556 "contact-contact-type" => ["author", "contact-type"],
557 "writable" => "IF (`post`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `author`.`writable`)",
559 "cid" => ["author", "id"],
560 "alias" => ["author", "alias"],
561 "photo" => ["author", "photo"],
562 "name-date" => ["author", "name-date"],
563 "uri-date" => ["author", "uri-date"],
564 "avatar-date" => ["author", "avatar-date"],
565 "thumb" => ["author", "thumb"],
566 "dfrn-id" => ["author", "dfrn-id"],
567 "author-id" => ["post-thread", "author-id"],
568 "author-link" => ["author", "url"],
569 "author-addr" => ["author", "addr"],
570 "author-name" => ["author", "name"],
571 "author-nick" => ["author", "nick"],
572 "author-avatar" => ["author", "thumb"],
573 "author-network" => ["author", "network"],
574 "author-blocked" => ["author", "blocked"],
575 "author-hidden" => ["author", "hidden"],
576 "owner-id" => ["post-thread", "owner-id"],
577 "owner-link" => ["owner", "url"],
578 "owner-addr" => ["owner", "addr"],
579 "owner-name" => ["owner", "name"],
580 "owner-nick" => ["owner", "nick"],
581 "owner-avatar" => ["owner", "thumb"],
582 "owner-network" => ["owner", "network"],
583 "owner-blocked" => ["owner", "blocked"],
584 "owner-hidden" => ["owner", "hidden"],
585 "owner-contact-type" => ["owner", "contact-type"],
586 "causer-id" => ["post-thread", "causer-id"],
587 "causer-link" => ["causer", "url"],
588 "causer-addr" => ["causer", "addr"],
589 "causer-name" => ["causer", "name"],
590 "causer-nick" => ["causer", "nick"],
591 "causer-avatar" => ["causer", "thumb"],
592 "causer-network" => ["causer", "network"],
593 "causer-blocked" => ["causer", "blocked"],
594 "causer-hidden" => ["causer", "hidden"],
595 "causer-contact-type" => ["causer", "contact-type"],
596 "signed_text" => ["diaspora-interaction", "interaction"],
597 "parent-guid" => ["parent-item-uri", "guid"],
598 "parent-network" => ["parent-post", "network"],
599 "parent-author-id" => ["parent-post", "author-id"],
600 "parent-author-link" => ["parent-post-author", "url"],
601 "parent-author-name" => ["parent-post-author", "name"],
602 "parent-author-network" => ["parent-post-author", "network"],
603 "parent-author-blocked" => ["parent-post-author", "blocked"],
604 "parent-author-hidden" => ["parent-post-author", "hidden"],
606 "query" => "FROM `post-thread`
607 INNER JOIN `post` ON `post`.`uri-id` = `post-thread`.`uri-id`
608 STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-thread`.`author-id`
609 STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-thread`.`owner-id`
610 LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-thread`.`causer-id`
611 LEFT JOIN `item-uri` ON `item-uri`.`id` = `post-thread`.`uri-id`
612 LEFT JOIN `item-uri` AS `thr-parent-item-uri` ON `thr-parent-item-uri`.`id` = `post`.`thr-parent-id`
613 LEFT JOIN `item-uri` AS `parent-item-uri` ON `parent-item-uri`.`id` = `post`.`parent-uri-id`
614 LEFT JOIN `item-uri` AS `external-item-uri` ON `external-item-uri`.`id` = `post`.`external-id`
615 LEFT JOIN `verb` ON `verb`.`id` = `post`.`vid`
616 LEFT JOIN `diaspora-interaction` ON `diaspora-interaction`.`uri-id` = `post-thread`.`uri-id`
617 LEFT JOIN `post-content` ON `post-content`.`uri-id` = `post-thread`.`uri-id`
618 LEFT JOIN `post` AS `parent-post` ON `parent-post`.`uri-id` = `post`.`parent-uri-id`
619 LEFT JOIN `contact` AS `parent-post-author` ON `parent-post-author`.`id` = `parent-post`.`author-id`"
623 "uri-id" => ["post-category", "uri-id"],
624 "uid" => ["post-category", "uid"],
625 "type" => ["post-category", "type"],
626 "tid" => ["post-category", "tid"],
627 "name" => ["tag", "name"],
628 "url" => ["tag", "url"],
630 "query" => "FROM `post-category`
631 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`"
635 "uri-id" => ["post-tag", "uri-id"],
636 "type" => ["post-tag", "type"],
637 "tid" => ["post-tag", "tid"],
638 "cid" => ["post-tag", "cid"],
639 "name" => "CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END",
640 "url" => "CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END",
642 "query" => "FROM `post-tag`
643 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
644 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`"
646 "network-item-view" => [
648 "uri-id" => ["post-user", "uri-id"],
649 "parent" => ["parent-post", "id"],
650 "received" => ["post-user", "received"],
651 "commented" => ["post-thread-user", "commented"],
652 "created" => ["post-user", "created"],
653 "uid" => ["post-user", "uid"],
654 "starred" => ["post-thread-user", "starred"],
655 "mention" => ["post-thread-user", "mention"],
656 "network" => ["post-user", "network"],
657 "unseen" => ["post-user", "unseen"],
658 "gravity" => ["post-user", "gravity"],
659 "contact-id" => ["post-user", "contact-id"],
660 "contact-type" => ["ownercontact", "contact-type"],
662 "query" => "FROM `post-user`
663 STRAIGHT_JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
664 INNER JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
665 LEFT JOIN `user-contact` AS `author` ON `author`.`uid` = `post-thread-user`.`uid` AND `author`.`cid` = `post-thread-user`.`author-id`
666 LEFT JOIN `user-contact` AS `owner` ON `owner`.`uid` = `post-thread-user`.`uid` AND `owner`.`cid` = `post-thread-user`.`owner-id`
667 INNER JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
668 LEFT JOIN `post-user` AS `parent-post` ON `parent-post`.`uri-id` = `post-user`.`parent-uri-id` AND `parent-post`.`uid` = `post-user`.`uid`
669 WHERE `post-user`.`visible` AND NOT `post-user`.`deleted`
670 AND (NOT `contact`.`readonly` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`)
671 AND (`post-user`.`hidden` IS NULL OR NOT `post-user`.`hidden`)
672 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
673 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
675 "network-thread-view" => [
677 "uri-id" => ["post-thread-user", "uri-id"],
678 "parent" => ["parent-post", "id"],
679 "received" => ["post-thread-user", "received"],
680 "commented" => ["post-thread-user", "commented"],
681 "created" => ["post-thread-user", "created"],
682 "uid" => ["post-thread-user", "uid"],
683 "starred" => ["post-thread-user", "starred"],
684 "mention" => ["post-thread-user", "mention"],
685 "network" => ["post-thread-user", "network"],
686 "contact-id" => ["post-thread-user", "contact-id"],
687 "contact-type" => ["ownercontact", "contact-type"],
689 "query" => "FROM `post-thread-user`
690 INNER JOIN `post-user` ON `post-user`.`id` = `post-thread-user`.`post-user-id`
691 STRAIGHT_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 LEFT 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-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
699 AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
700 AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
704 "id" => ["contact", "id"],
705 "uid" => ["contact", "uid"],
706 "created" => ["contact", "created"],
707 "updated" => ["contact", "updated"],
708 "self" => ["contact", "self"],
709 "remote_self" => ["contact", "remote_self"],
710 "rel" => ["contact", "rel"],
711 "duplex" => ["contact", "duplex"],
712 "network" => ["contact", "network"],
713 "protocol" => ["contact", "protocol"],
714 "name" => ["contact", "name"],
715 "nick" => ["contact", "nick"],
716 "location" => ["contact", "location"],
717 "about" => ["contact", "about"],
718 "keywords" => ["contact", "keywords"],
719 "gender" => ["contact", "gender"],
720 "xmpp" => ["contact", "xmpp"],
721 "attag" => ["contact", "attag"],
722 "avatar" => ["contact", "avatar"],
723 "photo" => ["contact", "photo"],
724 "thumb" => ["contact", "thumb"],
725 "micro" => ["contact", "micro"],
726 "header" => ["contact", "header"],
727 "site-pubkey" => ["contact", "site-pubkey"],
728 "issued-id" => ["contact", "issued-id"],
729 "dfrn-id" => ["contact", "dfrn-id"],
730 "url" => ["contact", "url"],
731 "nurl" => ["contact", "nurl"],
732 "addr" => ["contact", "addr"],
733 "alias" => ["contact", "alias"],
734 "pubkey" => ["contact", "pubkey"],
735 "prvkey" => ["contact", "prvkey"],
736 "batch" => ["contact", "batch"],
737 "request" => ["contact", "request"],
738 "notify" => ["contact", "notify"],
739 "poll" => ["contact", "poll"],
740 "confirm" => ["contact", "confirm"],
741 "poco" => ["contact", "poco"],
742 "aes_allow" => ["contact", "aes_allow"],
743 "ret-aes" => ["contact", "ret-aes"],
744 "usehub" => ["contact", "usehub"],
745 "subhub" => ["contact", "subhub"],
746 "hub-verify" => ["contact", "hub-verify"],
747 "last-update" => ["contact", "last-update"],
748 "success_update" => ["contact", "success_update"],
749 "failure_update" => ["contact", "failure_update"],
750 "name-date" => ["contact", "name-date"],
751 "uri-date" => ["contact", "uri-date"],
752 "avatar-date" => ["contact", "avatar-date"],
753 "picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
754 "term-date" => ["contact", "term-date"],
755 "last-item" => ["contact", "last-item"],
756 "priority" => ["contact", "priority"],
757 "blocked" => ["user", "blocked"],
758 "block_reason" => ["contact", "block_reason"],
759 "readonly" => ["contact", "readonly"],
760 "writable" => ["contact", "writable"],
761 "forum" => ["contact", "forum"],
762 "prv" => ["contact", "prv"],
763 "contact-type" => ["contact", "contact-type"],
764 "manually-approve" => ["contact", "manually-approve"],
765 "hidden" => ["contact", "hidden"],
766 "archive" => ["contact", "archive"],
767 "pending" => ["contact", "pending"],
768 "deleted" => ["contact", "deleted"],
769 "unsearchable" => ["contact", "unsearchable"],
770 "sensitive" => ["contact", "sensitive"],
771 "baseurl" => ["contact", "baseurl"],
772 "reason" => ["contact", "reason"],
773 "closeness" => ["contact", "closeness"],
774 "info" => ["contact", "info"],
775 "profile-id" => ["contact", "profile-id"],
776 "bdyear" => ["contact", "bdyear"],
777 "bd" => ["contact", "bd"],
778 "notify_new_posts" => ["contact", "notify_new_posts"],
779 "fetch_further_information" => ["contact", "fetch_further_information"],
780 "ffi_keyword_denylist" => ["contact", "ffi_keyword_denylist"],
781 "parent-uid" => ["user", "parent-uid"],
782 "guid" => ["user", "guid"],
783 "nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
784 "email" => ["user", "email"],
785 "openid" => ["user", "openid"],
786 "timezone" => ["user", "timezone"],
787 "language" => ["user", "language"],
788 "register_date" => ["user", "register_date"],
789 "login_date" => ["user", "login_date"],
790 "default-location" => ["user", "default-location"],
791 "allow_location" => ["user", "allow_location"],
792 "theme" => ["user", "theme"],
793 "upubkey" => ["user", "pubkey"],
794 "uprvkey" => ["user", "prvkey"],
795 "sprvkey" => ["user", "sprvkey"],
796 "spubkey" => ["user", "spubkey"],
797 "verified" => ["user", "verified"],
798 "blockwall" => ["user", "blockwall"],
799 "hidewall" => ["user", "hidewall"],
800 "blocktags" => ["user", "blocktags"],
801 "unkmail" => ["user", "unkmail"],
802 "cntunkmail" => ["user", "cntunkmail"],
803 "notify-flags" => ["user", "notify-flags"],
804 "page-flags" => ["user", "page-flags"],
805 "account-type" => ["user", "account-type"],
806 "prvnets" => ["user", "prvnets"],
807 "maxreq" => ["user", "maxreq"],
808 "expire" => ["user", "expire"],
809 "account_removed" => ["user", "account_removed"],
810 "account_expired" => ["user", "account_expired"],
811 "account_expires_on" => ["user", "account_expires_on"],
812 "expire_notification_sent" => ["user", "expire_notification_sent"],
813 "def_gid" => ["user", "def_gid"],
814 "allow_cid" => ["user", "allow_cid"],
815 "allow_gid" => ["user", "allow_gid"],
816 "deny_cid" => ["user", "deny_cid"],
817 "deny_gid" => ["user", "deny_gid"],
818 "openidserver" => ["user", "openidserver"],
819 "publish" => ["profile", "publish"],
820 "net-publish" => ["profile", "net-publish"],
821 "hide-friends" => ["profile", "hide-friends"],
822 "prv_keywords" => ["profile", "prv_keywords"],
823 "pub_keywords" => ["profile", "pub_keywords"],
824 "address" => ["profile", "address"],
825 "locality" => ["profile", "locality"],
826 "region" => ["profile", "region"],
827 "postal-code" => ["profile", "postal-code"],
828 "country-name" => ["profile", "country-name"],
829 "homepage" => ["profile", "homepage"],
830 "dob" => ["profile", "dob"],
832 "query" => "FROM `user`
833 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
834 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`"
838 "id" => ["register", "id"],
839 "hash" => ["register", "hash"],
840 "created" => ["register", "created"],
841 "uid" => ["register", "uid"],
842 "password" => ["register", "password"],
843 "language" => ["register", "language"],
844 "note" => ["register", "note"],
845 "self" => ["contact", "self"],
846 "name" => ["contact", "name"],
847 "url" => ["contact", "url"],
848 "micro" => ["contact", "micro"],
849 "email" => ["user", "email"],
850 "nick" => ["contact", "nick"],
852 "query" => "FROM `register`
853 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
854 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`"
856 "tag-search-view" => [
858 "uri-id" => ["post-tag", "uri-id"],
859 "uid" => ["post-user", "uid"],
860 "iid" => ["post-user", "id"],
861 "private" => ["post-user", "private"],
862 "wall" => ["post-user", "wall"],
863 "origin" => ["post-user", "origin"],
864 "global" => ["post-user", "global"],
865 "gravity" => ["post-user", "gravity"],
866 "received" => ["post-user", "received"],
867 "network" => ["post-user", "network"],
868 "author-id" => ["post-user", "author-id"],
869 "name" => ["tag", "name"],
871 "query" => "FROM `post-tag`
872 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
873 STRAIGHT_JOIN `post-user` ON `post-user`.`uri-id` = `post-tag`.`uri-id`
874 WHERE `post-tag`.`type` = 1"
876 "workerqueue-view" => [
878 "pid" => ["process", "pid"],
879 "priority" => ["workerqueue", "priority"],
881 "query" => "FROM `process`
882 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
883 WHERE NOT `workerqueue`.`done`"