Review funkt

This commit is contained in:
2026-08-09 21:56:00 +00:00
parent f522ae9953
commit fe9dfa4519
11366 changed files with 2335077 additions and 97 deletions

View File

@@ -0,0 +1,19 @@
-- A parent job's child dependencies of a given status, sliced [offset, limit]
-- and joined to the child job rows (for fetchJobs). Params: $1 parent_queue,
-- $2 parent_id, $3 status ('pending' | 'processed'), $4 offset, $5 limit
-- (NULL = no limit). `total` is the full number of matching dependencies
-- (COUNT(*) OVER(), computed before the slice). `dep_value` is the stored
-- result for processed children. The remaining columns are the child
-- `job` row consumed by rowToJobJson.
SELECT
d.child_key,
d.value AS dep_value,
COUNT(*) OVER() AS total,
j.*
FROM job_dependency d
LEFT JOIN job j
ON j.queue = d.child_queue AND j.id = d.child_id
WHERE d.parent_queue = $1 AND d.parent_id = $2 AND d.status = $3::dep_status
ORDER BY d.child_key
OFFSET $4
LIMIT $5;