basestructure
This commit is contained in:
@@ -10,10 +10,10 @@ SELECT EXISTS (
|
||||
);
|
||||
|
||||
-- name: GetQuery :one
|
||||
SELECT q.id, q.type, q.activeVersion, q.latestVersion, c.config, ARRAY_AGG(r.requiredQueryId) AS requiredIds
|
||||
SELECT q.id, q.type, q.activeVersion, q.latestVersion, c.config, ARRAY_AGG(DISTINCT r.requiredQueryId) as requiredIds
|
||||
FROM queries AS q
|
||||
JOIN queryConfigs AS c ON q.id = c.queryId
|
||||
JOIN requiredQueries AS r ON q.id = r.queryId
|
||||
LEFT JOIN queryConfigs AS c ON q.id = c.queryId
|
||||
LEFT JOIN requiredQueries AS r ON q.id = r.queryId
|
||||
WHERE q.id = $1
|
||||
and c.addedVersion >= q.activeVersion
|
||||
and COALESCE(c.removedVersion, q.activeVersion - 1) < q.activeVersion
|
||||
@@ -24,8 +24,8 @@ SELECT q.id, q.type, q.activeVersion, q.latestVersion, c.config, ARRAY_AGG(r.req
|
||||
-- name: ListQueries :many
|
||||
SELECT q.id, q.type, q.activeVersion, q.latestVersion, c.config, ARRAY_AGG(r.requiredQueryId) AS requiredIds
|
||||
FROM queries AS q
|
||||
JOIN queryConfigs AS c ON q.id = c.queryId
|
||||
JOIN requiredQueries AS r ON q.id = r.queryId
|
||||
LEFT JOIN queryConfigs AS c ON q.id = c.queryId
|
||||
LEFT JOIN requiredQueries AS r ON q.id = r.queryId
|
||||
WHERE c.addedVersion >= q.activeVersion
|
||||
and COALESCE(c.removedVersion, q.activeVersion - 1) < q.activeVersion
|
||||
and r.addedVersion >= q.activeVersion
|
||||
|
||||
Reference in New Issue
Block a user