chore: implement deleting custom roles (#14101)

* chore: implement deleting custom roles

* add trigger to delete role from organization members on delete
* chore: add comments to explain populated field
This commit is contained in:
Steven Masley
2024-08-07 12:37:55 -05:00
committed by GitHub
parent d0feb70811
commit 2c13797350
19 changed files with 627 additions and 2 deletions

View File

@ -6520,6 +6520,24 @@ func (q *sqlQuerier) CustomRoles(ctx context.Context, arg CustomRolesParams) ([]
return items, nil
}
const deleteCustomRole = `-- name: DeleteCustomRole :exec
DELETE FROM
custom_roles
WHERE
name = lower($1)
AND organization_id = $2
`
type DeleteCustomRoleParams struct {
Name string `db:"name" json:"name"`
OrganizationID uuid.NullUUID `db:"organization_id" json:"organization_id"`
}
func (q *sqlQuerier) DeleteCustomRole(ctx context.Context, arg DeleteCustomRoleParams) error {
_, err := q.db.ExecContext(ctx, deleteCustomRole, arg.Name, arg.OrganizationID)
return err
}
const upsertCustomRole = `-- name: UpsertCustomRole :one
INSERT INTO
custom_roles (