Skip to content

perf: harden User and Transaction models with targeted indexes - #426

Merged
chizzy192 merged 1 commit into
StellarState:devfrom
privexlabs:fix/enhance-user-transaction-models-333-336
Aug 30, 2026
Merged

perf: harden User and Transaction models with targeted indexes#426
chizzy192 merged 1 commit into
StellarState:devfrom
privexlabs:fix/enhance-user-transaction-models-333-336

Conversation

@privexlabs

Copy link
Copy Markdown
Contributor

Summary

Hardens the User and Transaction TypeORM entities for heavy-load resilience and query performance, addressing sub-optimal data fetching patterns and a type-safety gap identified in the Database & Migrations domain.

Changes

  • src/models/User.model.ts: added a composite index on (userType, kycStatus) to speed up combined user-segment and verification-status lookups; corrected isKycVerified to be a required boolean (it is a NOT NULL column with a database default, but was typed as optional, allowing an incorrect undefined state at compile time).
  • src/models/Transaction.model.ts: added a composite index on (status, type, timestamp) matching the exact filter/sort used by the pending Stellar-state reconciliation worker; added an index on stellar_tx_hash to speed up existing lookups performed during payment verification and reconciliation.
  • src/migrations/1732300000000-AddUserAndTransactionPerformanceIndexes.ts: new migration creating the three indexes above (idempotent CREATE INDEX IF NOT EXISTS, with a matching down migration), following the repository's existing migration conventions.

Issues

Resolves #333
Resolves #334
Resolves #335
Resolves #336

Verification

  • Manual code review completed: git status, git diff --stat, and the full git diff were inspected; only the two targeted model files and one new migration file are changed.
  • cargo build was not run.
  • cargo test was not run.
  • No snapshots were committed.

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@privexlabs Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@chizzy192
chizzy192 merged commit c19c880 into StellarState:dev Aug 30, 2026
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants