Skip to content

Commit 4667171

Browse files
Added comments for SQL query
1 parent 18ad931 commit 4667171

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

coderd/database/queries.sql.go

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

coderd/database/queries/prebuilds.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ WHERE (b.transition = 'start'::workspace_transition
4040
SELECT t.id AS template_id, wpb.template_version_id, wpb.transition, COUNT(wpb.transition)::int AS count
4141
FROM workspace_latest_builds wlb
4242
INNER JOIN workspace_prebuild_builds wpb ON wpb.id = wlb.id
43+
-- We only need these counts for active template versions.
44+
-- It doesn't influence whether we create or delete prebuilds
45+
-- for inactive template versions. This is because we never create
46+
-- prebuilds for inactive template versions, we always delete
47+
-- running prebuilds for inactive template versions, and we ignore
48+
-- prebuilds that are still building.
4349
INNER JOIN templates t ON t.active_version_id = wlb.template_version_id
4450
WHERE wlb.job_status IN ('pending'::provisioner_job_status, 'running'::provisioner_job_status)
4551
GROUP BY t.id, wpb.template_version_id, wpb.transition;

0 commit comments

Comments
 (0)