Skip to content

feat(email-template): add indexes for common query paths - #1401

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
fathiaoyinloye:feat/1235-add-email-template-indexes
Aug 30, 2026
Merged

feat(email-template): add indexes for common query paths#1401
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
fathiaoyinloye:feat/1235-add-email-template-indexes

Conversation

@fathiaoyinloye

Copy link
Copy Markdown
Contributor

Summary

Adds database indexes to the email-template entity to improve the performance of common lookup, filtering, sorting, and foreign-key query paths.

Changes

  • Reviewed the query paths targeting email-template.
  • Added appropriate @Index decorators to src/email-marketing/entities/email-template.entity.ts.
  • Added a migration at src/migrations/-add-email-template-indexes.ts.
  • Ensured the migration creates the same indexes declared by the entity.
  • Avoided duplicate or redundant indexes.

Why

The email-template entity previously had no declared indexes, which can result in sequential scans as the table grows. Indexing the columns used by common query paths allows the database to execute these lookups more efficiently.

Validation

  • Entity indexes match the indexes created by the migration.
  • Migration runs cleanly against an existing database.
  • Existing migrations remain unaffected.
  • No duplicate or redundant indexes are introduced.
  • Relevant tests/type checks/lint pass.

Validation commands

# Add the exact project commands used for validation here.

Acceptance Criteria

  • Common lookup and foreign-key columns are indexed.
  • Migration creates all required indexes.
  • Migration runs cleanly on an existing database.
  • No duplicate/redundant indexes are introduced.

closes #1235

Add indexes to frequently queried and foreign-key columns on the
email-template entity and create a migration to apply them to
existing databases.

Avoid duplicate or redundant indexes while covering common WHERE,
ORDER BY, JOIN, and foreign-key lookups.
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@fathiaoyinloye 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

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project

@RUKAYAT-CODER
RUKAYAT-CODER merged commit a0cd4dc into rinafcode:main Aug 30, 2026
3 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

Development

Successfully merging this pull request may close these issues.

Add database indexes to the email-template entity

2 participants