Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: add workspace_build_deadlines view
  • Loading branch information
f0ssel committed May 15, 2024
commit 779b5f2a97b9ee86d599fd4c9503e528633c6331
Empty file.
13 changes: 13 additions & 0 deletions coderd/database/migrations/000209_workspace_deadline_view.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE VIEW workspace_build_deadlines AS
SELECT
workspace_builds.id,
LEAST(
workspaces.last_used_at + (workspaces.ttl / 1000 / 1000 / 1000 || ' seconds')::interval,
workspace_builds.max_deadline
)::timestamp with time zone AS deadline
FROM
workspace_builds
LEFT JOIN
workspaces
ON
workspace_builds.workspace_id = workspaces.id;