getandlist
This commit is contained in:
@@ -5,7 +5,7 @@ SELECT id, config FROM queryConfigs where queryId = $1 and addedVersion >= $2 an
|
||||
SELECT type FROM queries where id = $1;
|
||||
|
||||
-- name: DeprecateQuery :exec
|
||||
INSERT INTO queryDeprecations (queryId) VALUES ($1) RETURNING id;
|
||||
INSERT INTO queryDeprecations (queryId) VALUES ($1);
|
||||
|
||||
-- name: IsQueryDeprecated :one
|
||||
SELECT EXISTS (
|
||||
@@ -22,4 +22,15 @@ SELECT q.id, q.type, q.activeVersion, c.config, ARRAY_AGG(r.requiredQueryId) AS
|
||||
and COALESCE(c.removedVersion, q.activeVersion - 1) < q.activeVersion
|
||||
and r.addedVersion >= q.activeVersion
|
||||
and COALESCE(r.removedVersion, q.activeVersion - 1) < q.activeVersion
|
||||
GROUP BY q.id, c.config;
|
||||
|
||||
-- name: ListQueries :many
|
||||
SELECT q.id, q.type, q.activeVersion, 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
|
||||
WHERE c.addedVersion >= q.activeVersion
|
||||
and COALESCE(c.removedVersion, q.activeVersion - 1) < q.activeVersion
|
||||
and r.addedVersion >= q.activeVersion
|
||||
and COALESCE(r.removedVersion, q.activeVersion - 1) < q.activeVersion
|
||||
GROUP BY q.id, c.config;
|
||||
Reference in New Issue
Block a user