Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions templates/backend/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
- Use a connection pool — never open a new connection per request
- Inject the database session/connection as a dependency — no global DB
handles
- Set explicit pool size limits appropriate to the deployment
(e.g. `pool_size=10`, `max_overflow=5` for a single-instance service)
- Set explicit pool size limits from the instance count and the
database's connection cap (e.g. `pool_size=10`, `max_overflow=5` for one
instance)
- Monitor pool exhaustion — alert when pool wait time exceeds threshold

## Soft deletes
Expand All @@ -54,7 +55,7 @@
required; otherwise use hard deletes
- If using soft deletes, add a partial index on `deleted_at IS NULL` and
filter all queries by default — never return deleted rows to callers
- Consider an append-only audit log table as an alternative to soft deletes
- Keep an append-only audit log table instead of soft deletes (MAY)

## Testing
[EXTEND: base-testing]
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/template-quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ templates/backend/api.md 94.9
templates/backend/auth.md 98.4
templates/backend/caching.md 100.0
templates/backend/concurrency.md 94.8
templates/backend/database.md 92.0
templates/backend/database.md 100.0
templates/backend/edge.md 97.9
templates/backend/errors.md 98.3
templates/backend/features.md 92.2
Expand Down
Loading