Skip to content

Commit c3aef93

Browse files
authored
feat: add locked TTL field to template meta (#8020)
1 parent 1ecc371 commit c3aef93

File tree

27 files changed

+291
-90
lines changed

27 files changed

+291
-90
lines changed

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/database/dump.sql

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
BEGIN;
2+
ALTER TABLE templates DROP COLUMN locked_ttl;
3+
COMMIT;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
BEGIN;
2+
ALTER TABLE templates ADD COLUMN locked_ttl BIGINT NOT NULL DEFAULT 0;
3+
COMMIT;

coderd/database/modelqueries.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (q *sqlQuerier) GetAuthorizedTemplates(ctx context.Context, arg GetTemplate
5454
pq.Array(arg.IDs),
5555
)
5656
if err != nil {
57-
return nil, err
57+
return nil, xerrors.Errorf("query context: %w", err)
5858
}
5959
defer rows.Close()
6060
var items []Template
@@ -82,16 +82,17 @@ func (q *sqlQuerier) GetAuthorizedTemplates(ctx context.Context, arg GetTemplate
8282
&i.AllowUserAutostop,
8383
&i.FailureTTL,
8484
&i.InactivityTTL,
85+
&i.LockedTTL,
8586
); err != nil {
86-
return nil, err
87+
return nil, xerrors.Errorf("scan: %w", err)
8788
}
8889
items = append(items, i)
8990
}
9091
if err := rows.Close(); err != nil {
91-
return nil, err
92+
return nil, xerrors.Errorf("close: %w", err)
9293
}
9394
if err := rows.Err(); err != nil {
94-
return nil, err
95+
return nil, xerrors.Errorf("rows err: %w", err)
9596
}
9697
return items, nil
9798
}

coderd/database/models.go

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

coderd/database/queries.sql.go

Lines changed: 20 additions & 9 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ SET
120120
default_ttl = $5,
121121
max_ttl = $6,
122122
failure_ttl = $7,
123-
inactivity_ttl = $8
123+
inactivity_ttl = $8,
124+
locked_ttl = $9
124125
WHERE
125126
id = $1
126127
RETURNING

coderd/database/sqlc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ overrides:
5656
failure_ttl: FailureTTL
5757
inactivity_ttl: InactivityTTL
5858
eof: EOF
59+
locked_ttl: LockedTTL
5960

6061
sql:
6162
- schema: "./dump.sql"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy