Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: enforce template-level constraints for TTL and autostart #2018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 7, 2022
Merged
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
Prev Previous commit
Next Next commit
RED: add migrations and make gen
  • Loading branch information
johnstcn committed Jun 3, 2022
commit f11f942858f8b4f4d290b2f4676a8a31fa42add3
4 changes: 3 additions & 1 deletion coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE ONLY templates DROP COLUMN IF EXISTS max_ttl;
ALTER TABLE ONLY templates DROP COLUMN IF EXISTS min_autostart_interval;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE ONLY templates ADD COLUMN IF NOT EXISTS max_ttl BIGINT NOT NULL DEFAULT 604800000000000; -- 168 hours
ALTER TABLE ONLY templates ADD COLUMN IF NOT EXISTS min_autostart_interval BIGINT NOT NULL DEFAULT 3600000000000; -- 1 hour
20 changes: 11 additions & 9 deletions coderd/database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion site/src/api/typesGenerated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export interface CreateTemplateRequest {
readonly description?: string
readonly template_version_id: string
readonly parameter_values?: CreateParameterRequest[]
readonly max_ttl_ms?: number
readonly min_autostart_interval_ms?: number
}

// From codersdk/templateversions.go:121:6
Expand Down Expand Up @@ -96,7 +98,7 @@ export interface CreateWorkspaceBuildRequest {
readonly state?: string
}

// From codersdk/organizations.go:67:6
// From codersdk/organizations.go:76:6
export interface CreateWorkspaceRequest {
readonly template_id: string
readonly name: string
Expand Down