Skip to content

Commit 1a64acd

Browse files
committed
fix: Order database queries for templates
Fixes a race in a test where the order of templates varies.
1 parent f310aeb commit 1a64acd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

coderd/database/queries.sql.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/templates.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ WHERE
3434
id = ANY(@ids)
3535
ELSE true
3636
END
37+
ORDER BY (created_at, id) ASC
3738
;
3839

3940
-- name: GetTemplateByOrganizationAndName :one
@@ -49,7 +50,9 @@ LIMIT
4950
1;
5051

5152
-- name: GetTemplates :many
52-
SELECT * FROM templates;
53+
SELECT * FROM templates
54+
ORDER BY (created_at, id) ASC
55+
;
5356

5457
-- name: InsertTemplate :one
5558
INSERT INTO

0 commit comments

Comments
 (0)