Skip to content

Commit 65ffa20

Browse files
authored
fix: use correct empty uuids (#4917)
1 parent 1898f67 commit 65ffa20

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

coderd/database/queries.sql.go

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

coderd/database/queries/auditlogs.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ WHERE
2222
END
2323
-- Filter resource_id
2424
AND CASE
25-
WHEN @resource_id :: uuid != '00000000-00000000-00000000-00000000' THEN
25+
WHEN @resource_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
2626
resource_id = @resource_id
2727
ELSE true
2828
END
@@ -83,7 +83,7 @@ WHERE
8383
END
8484
-- Filter resource_id
8585
AND CASE
86-
WHEN @resource_id :: uuid != '00000000-00000000-00000000-00000000' THEN
86+
WHEN @resource_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
8787
resource_id = @resource_id
8888
ELSE true
8989
END

coderd/database/queries/templates.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ WHERE
1818
templates.deleted = @deleted
1919
-- Filter by organization_id
2020
AND CASE
21-
WHEN @organization_id :: uuid != '00000000-00000000-00000000-00000000' THEN
21+
WHEN @organization_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
2222
organization_id = @organization_id
2323
ELSE true
2424
END

coderd/database/queries/templateversions.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ WHERE
99
-- This allows using the last element on a page as effectively a cursor.
1010
-- This is an important option for scripts that need to paginate without
1111
-- duplicating or missing data.
12-
WHEN @after_id :: uuid != '00000000-00000000-00000000-00000000' THEN (
12+
WHEN @after_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN (
1313
-- The pagination cursor is the last ID of the previous page.
1414
-- The query is ordered by the created_at field, so select all
1515
-- rows after the cursor.

coderd/database/queries/users.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ WHERE
102102
-- This allows using the last element on a page as effectively a cursor.
103103
-- This is an important option for scripts that need to paginate without
104104
-- duplicating or missing data.
105-
WHEN @after_id :: uuid != '00000000-00000000-00000000-00000000' THEN (
105+
WHEN @after_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN (
106106
-- The pagination cursor is the last ID of the previous page.
107107
-- The query is ordered by the created_at field, so select all
108108
-- rows after the cursor.

coderd/database/queries/workspacebuilds.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ WHERE
4242
-- This allows using the last element on a page as effectively a cursor.
4343
-- This is an important option for scripts that need to paginate without
4444
-- duplicating or missing data.
45-
WHEN @after_id :: uuid != '00000000-00000000-00000000-00000000' THEN (
45+
WHEN @after_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN (
4646
-- The pagination cursor is the last ID of the previous page.
4747
-- The query is ordered by the build_number field, so select all
4848
-- rows after the cursor.

coderd/database/queries/workspaces.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ WHERE
102102
END
103103
-- Filter by owner_id
104104
AND CASE
105-
WHEN @owner_id :: uuid != '00000000-00000000-00000000-00000000' THEN
105+
WHEN @owner_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
106106
owner_id = @owner_id
107107
ELSE true
108108
END
@@ -240,7 +240,7 @@ WHERE
240240
END
241241
-- Filter by owner_id
242242
AND CASE
243-
WHEN @owner_id :: uuid != '00000000-00000000-00000000-00000000' THEN
243+
WHEN @owner_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN
244244
owner_id = @owner_id
245245
ELSE true
246246
END

0 commit comments

Comments
 (0)