Skip to content

Add database indexes to the message entity - #1403

Open
azahjessica49-commits wants to merge 1 commit into
rinafcode:mainfrom
azahjessica49-commits:fix/add-message-indexes
Open

Add database indexes to the message entity#1403
azahjessica49-commits wants to merge 1 commit into
rinafcode:mainfrom
azahjessica49-commits:fix/add-message-indexes

Conversation

@azahjessica49-commits

Copy link
Copy Markdown

$## Overview\n\nAdds database indexes to the messages table to improve performance of common query paths, specifically conversation lookups between two users and lookups by sender/recipient.\n\n## Related Issue\n\nCloses #1240\n\n## Changes\n\n### 📇 Message Entity Indexes\n\n* [MODIFY] src/messaging/message.entity.ts\n * Added @Index decorators for senderId, recipientId.\n * Added composite indexes (senderId, recipientId, createdAt) and (recipientId, senderId, createdAt) to cover bidirectional conversation queries with ordering.\n\n* [ADD] src/migrations/1804000000000-add-message-indexes.ts\n * Migration creates the same indexes on existing databases.\n\n## Verification Results\n\n\nnpm run migrations:check\n✅ All migration files validated\n\nnpm run typecheck\n✅ No new errors introduced by message entity changes\n\n\n| Acceptance Criteria | Status |\n| --- | --- |\n| Entity carries indexes covering common lookup/foreign-key columns | ✅ senderId, recipientId, and composite conversation indexes added |\n| Migration creates indexes and runs cleanly on existing database | ✅ Reviewable migration included with up/down |\n| No duplicate/redundant indexes introduced | ✅ Indexes chosen based on actual query paths in messaging.service.ts |

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@azahjessica49-commits 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

Well done on the job done so far!
Kindly fix workflow to pass

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.

2 participants