Add database indexes to the message entity - #1403
Open
azahjessica49-commits wants to merge 1 commit into
Open
Conversation
|
@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! 🚀 |
Contributor
|
Well done on the job done so far! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
$## Overview\n\nAdds database indexes to the
messagestable 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@Indexdecorators forsenderId,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 withup/down|\n| No duplicate/redundant indexes introduced | ✅ Indexes chosen based on actual query paths inmessaging.service.ts|