mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(db): remove 23 unused database methods (#22999)
Removes 22 database query methods with no callers outside generated code and the dbauthz wrapper layer (~1,600 lines). **Security keys (6)** — superseded by `cryptokeys` package: `GetAppSecurityKey`, `UpsertAppSecurityKey`, `GetOAuthSigningKey`, `UpsertOAuthSigningKey`, `GetCoordinatorResumeTokenSigningKey`, `UpsertCoordinatorResumeTokenSigningKey` **Superseded queries (4):** - `GetProvisionerJobsByIDs` → `GetProvisionerJobsByIDsWithQueuePosition` - `GetDeploymentDAUs` / `GetTemplateDAUs` → `GetTemplateInsightsByInterval` - `GetWorkspaceBuildParametersByBuildIDs` + its `GetAuthorized...` variant → unused **OAuth2 (2):** `GetOAuth2ProviderAppByRegistrationToken`, `UpdateOAuth2ProviderAppSecretByID` **Chat (4)** — pre-wired with no callers: `GetChatModelConfigByProviderAndModel`, `DeleteChatMessagesByChatID`, `ListChatsByRootID`, `ListChildChatsByParentID` **Other (6):** `DeleteGitSSHKey`, `UpdateUserLinkedID`, `GetFileIDByTemplateVersionID`, `GetTemplateVersionHasAITask`, `InsertUserGroupsByName`, `RemoveUserFromAllGroups`
This commit is contained in:
@@ -31,25 +31,6 @@ WHERE group_id = @group_id
|
||||
user_is_system = false
|
||||
END;
|
||||
|
||||
-- InsertUserGroupsByName adds a user to all provided groups, if they exist.
|
||||
-- name: InsertUserGroupsByName :exec
|
||||
WITH groups AS (
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
groups
|
||||
WHERE
|
||||
groups.organization_id = @organization_id AND
|
||||
groups.name = ANY(@group_names :: text [])
|
||||
)
|
||||
INSERT INTO
|
||||
group_members (user_id, group_id)
|
||||
SELECT
|
||||
@user_id,
|
||||
groups.id
|
||||
FROM
|
||||
groups;
|
||||
|
||||
-- InsertUserGroupsByID adds a user to all provided groups, if they exist.
|
||||
-- name: InsertUserGroupsByID :many
|
||||
WITH groups AS (
|
||||
@@ -71,12 +52,6 @@ FROM
|
||||
ON CONFLICT DO NOTHING
|
||||
RETURNING group_id;
|
||||
|
||||
-- name: RemoveUserFromAllGroups :exec
|
||||
DELETE FROM
|
||||
group_members
|
||||
WHERE
|
||||
user_id = @user_id;
|
||||
|
||||
-- name: RemoveUserFromGroups :many
|
||||
DELETE FROM
|
||||
group_members
|
||||
|
||||
Reference in New Issue
Block a user