mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
fix(coderd): mark sub agent deletion via boolean instead of delete (#18411)
Deletion of data is uncommon in our database, so the introduction of sub agents and the deletion of them introduced issues with foreign key assumptions, as can be seen in coder/internal#685. We could have only addressed the specific case by allowing cascade deletion of stats as well as handling in the stats collector, but it's unclear how many more such edge-cases we could run into. In this change, we mark the rows as deleted via boolean instead, and filter them out in all relevant queries. Fixes coder/internal#685
This commit is contained in:
committed by
GitHub
parent
68f21fa523
commit
511fd09582
@ -3628,6 +3628,8 @@ type WorkspaceAgent struct {
|
||||
ParentID uuid.NullUUID `db:"parent_id" json:"parent_id"`
|
||||
// Defines the scope of the API key associated with the agent. 'all' allows access to everything, 'no_user_data' restricts it to exclude user data.
|
||||
APIKeyScope AgentKeyScopeEnum `db:"api_key_scope" json:"api_key_scope"`
|
||||
// Indicates whether or not the agent has been deleted. This is currently only applicable to sub agents.
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
}
|
||||
|
||||
// Workspace agent devcontainer configuration
|
||||
|
Reference in New Issue
Block a user