mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: test metricscache on postgres (#16711)
metricscache_test has been running tests against dbmem only, instead of against postgres. Unfortunately the implementations of GetTemplateAverageBuildTime have diverged between dbmem and postgres. This change gets the tests working on Postgres and test for the behaviour postgres provides.
This commit is contained in:
@ -16253,13 +16253,11 @@ func (q *sqlQuerier) GetWorkspaceByWorkspaceAppID(ctx context.Context, workspace
|
||||
}
|
||||
|
||||
const getWorkspaceUniqueOwnerCountByTemplateIDs = `-- name: GetWorkspaceUniqueOwnerCountByTemplateIDs :many
|
||||
SELECT
|
||||
template_id, COUNT(DISTINCT owner_id) AS unique_owners_sum
|
||||
FROM
|
||||
workspaces
|
||||
WHERE
|
||||
template_id = ANY($1 :: uuid[]) AND deleted = false
|
||||
GROUP BY template_id
|
||||
SELECT templates.id AS template_id, COUNT(DISTINCT workspaces.owner_id) AS unique_owners_sum
|
||||
FROM templates
|
||||
LEFT JOIN workspaces ON workspaces.template_id = templates.id AND workspaces.deleted = false
|
||||
WHERE templates.id = ANY($1 :: uuid[])
|
||||
GROUP BY templates.id
|
||||
`
|
||||
|
||||
type GetWorkspaceUniqueOwnerCountByTemplateIDsRow struct {
|
||||
|
Reference in New Issue
Block a user