Skip to content

Commit dd4a94c

Browse files
committed
add queries to support rotating dbcrypt keys
1 parent 09cad5b commit dd4a94c

File tree

8 files changed

+138
-0
lines changed

8 files changed

+138
-0
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,10 @@ func (q *querier) GetGitAuthLink(ctx context.Context, arg database.GetGitAuthLin
924924
return fetch(q.log, q.auth, q.db.GetGitAuthLink)(ctx, arg)
925925
}
926926

927+
func (q *querier) GetGitAuthLinksByUserID(_ context.Context, _ uuid.UUID) ([]database.GitAuthLink, error) {
928+
return nil, xerrors.Errorf("this is intentionally not implemented")
929+
}
930+
927931
func (q *querier) GetGitSSHKey(ctx context.Context, userID uuid.UUID) (database.GitSSHKey, error) {
928932
return fetch(q.log, q.auth, q.db.GetGitSSHKey)(ctx, userID)
929933
}
@@ -1492,6 +1496,10 @@ func (q *querier) GetUserLinkByUserIDLoginType(ctx context.Context, arg database
14921496
return q.db.GetUserLinkByUserIDLoginType(ctx, arg)
14931497
}
14941498

1499+
func (q *querier) GetUserLinksByUserID(_ context.Context, _ uuid.UUID) ([]database.UserLink, error) {
1500+
return nil, xerrors.Errorf("this is intentionally not implemented")
1501+
}
1502+
14951503
func (q *querier) GetUsers(ctx context.Context, arg database.GetUsersParams) ([]database.GetUsersRow, error) {
14961504
// This does the filtering in SQL.
14971505
prep, err := prepareSQLFilter(ctx, q.auth, rbac.ActionRead, rbac.ResourceUser.Type)

coderd/database/dbfake/dbfake.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,10 @@ func (q *FakeQuerier) GetGitAuthLink(_ context.Context, arg database.GetGitAuthL
14361436
return database.GitAuthLink{}, sql.ErrNoRows
14371437
}
14381438

1439+
func (q *FakeQuerier) GetGitAuthLinksByUserID(_ context.Context, _ uuid.UUID) ([]database.GitAuthLink, error) {
1440+
panic("this is intentionally not implemented")
1441+
}
1442+
14391443
func (q *FakeQuerier) GetGitSSHKey(_ context.Context, userID uuid.UUID) (database.GitSSHKey, error) {
14401444
q.mutex.RLock()
14411445
defer q.mutex.RUnlock()
@@ -2876,6 +2880,10 @@ func (q *FakeQuerier) GetUserLinkByUserIDLoginType(_ context.Context, params dat
28762880
return database.UserLink{}, sql.ErrNoRows
28772881
}
28782882

2883+
func (q *FakeQuerier) GetUserLinksByUserID(ctx context.Context, userID uuid.UUID) ([]database.UserLink, error) {
2884+
panic("this is intentionally not implemented")
2885+
}
2886+
28792887
func (q *FakeQuerier) GetUsers(_ context.Context, params database.GetUsersParams) ([]database.GetUsersRow, error) {
28802888
if err := validateDatabaseType(params); err != nil {
28812889
return nil, err

coderd/database/dbmetrics/dbmetrics.go

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

coderd/database/dbmock/dbmock.go

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

coderd/database/querier.go

Lines changed: 2 additions & 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: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/gitauth.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
-- name: GetGitAuthLink :one
22
SELECT * FROM git_auth_links WHERE provider_id = $1 AND user_id = $2;
33

4+
-- name: GetGitAuthLinksByUserID :many
5+
SELECT * FROM git_auth_links WHERE user_id = $1;
6+
7+
48
-- name: InsertGitAuthLink :one
59
INSERT INTO git_auth_links (
610
provider_id,

coderd/database/queries/user_links.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ FROM
1414
WHERE
1515
user_id = $1 AND login_type = $2;
1616

17+
-- name: GetUserLinksByUserID :many
18+
SELECT * FROM user_links WHERE user_id = $1;
19+
1720
-- name: InsertUserLink :one
1821
INSERT INTO
1922
user_links (

0 commit comments

Comments
 (0)