feat(coderd/database/dbpurge): make API keys retention configurable#21037
Merged
feat(coderd/database/dbpurge): make API keys retention configurable#21037
Conversation
This was referenced Dec 1, 2025
008a48a to
03f5ec5
Compare
07ae594 to
9ca58c3
Compare
9ca58c3 to
a21395a
Compare
03f5ec5 to
46f07e1
Compare
dannykopping
approved these changes
Dec 2, 2025
a21395a to
82f1c2b
Compare
46f07e1 to
27c90dd
Compare
Emyrk
approved these changes
Dec 2, 2025
| user_id = $1; | ||
|
|
||
| -- name: DeleteExpiredAPIKeys :one | ||
| -- name: DeleteExpiredAPIKeys :execrows |
Contributor
There was a problem hiding this comment.
I haven't! Those crows should watch out... 🐦⬛
82f1c2b to
2ce8f62
Compare
27c90dd to
1bed429
Compare
8cb020d to
2a45adb
Compare
Base automatically changed from
mafredri/feat-coderd-db-retention-policy-3
to
main
December 2, 2025 14:50
API keys retention is now explicit - it's enabled when --api-keys-retention is set to a non-zero duration (default 7d), and disabled when set to 0. No fallback to global retention.
Use :execrows instead of :one to simplify the query by removing the extra CTE wrapper. This lets PostgreSQL return the row count directly via RowsAffected() instead of requiring an explicit COUNT(*) scan.
1bed429 to
a6744f0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace hardcoded 7-day retention for expired API keys with configurable
retention from deployment settings. Skips deletion entirely when effective retention is 0.
Depends on #21021
Updates #20743
PR Stack
workspace_agent_logs