Skip to content

feat(database): add index management capability - #15

Merged
KilianBoute merged 1 commit into
mainfrom
feat/index-management
Aug 13, 2026
Merged

KilianBoute merged 1 commit into
mainfrom
feat/index-management

Conversation

@KilianBoute

@KilianBoute KilianBoute commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Description

This PR adds optional index management support to the database package by introducing a dedicated IndexManager capability and implementing it for both the MongoDB client and the mock database.

The main motivation is to make index creation a first-class, reusable operation without coupling the database layer to application-specific schema or index definitions. Consumers retain ownership of their indexes, while the shared database client now exposes a consistent way to create and manage them.

This improves the project by:

  • Enabling services to create MongoDB indexes programmatically through a shared abstraction instead of duplicating direct driver usage.
  • Keeping the database package flexible and domain-agnostic through an optional interface rather than expanding the core database contract.
  • Preserving testability by extending MockDatabase with full index creation support, including call tracking, queued responses, expectations, and reset handling.
  • Reducing the risk of production performance issues caused by missing or inconsistent indexes across environments.
  • Leveraging MongoDB’s idempotent CreateMany behavior, making index setup safe to run repeatedly during startup or deployment workflows.

The accompanying tests validate both successful index creation flows and error handling behavior to ensure the new capability behaves consistently in production and test environments.

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.64706% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/database/mongodb.go 0.00% 7 Missing ⚠️
pkg/database/mock.go 85.18% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@KilianBoute
KilianBoute merged commit 9da3a36 into main Aug 13, 2026
6 checks passed
@KilianBoute
KilianBoute deleted the feat/index-management branch August 13, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant