unindexed_foreign_keys validation for composite primary key on HABTM#212
Closed
benaitcheson wants to merge 2 commits into
Closed
unindexed_foreign_keys validation for composite primary key on HABTM#212benaitcheson wants to merge 2 commits into
unindexed_foreign_keys validation for composite primary key on HABTM#212benaitcheson wants to merge 2 commits into
Conversation
unindexed_foreign_keys validation for primary key on HABTMunindexed_foreign_keys validation for composite primary key on HABTM
Contributor
|
I think this will be fixed as part of #148. |
Author
Amazing! Thanks @fatkodima. Love your work. |
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.
Fix false positive for HABTM tables with composite primary keys
Problem
The UnindexedForeignKeys detector currently reports false positives for HABTM
(Has And Belongs To Many) tables that use composite primary keys. It suggests
adding indexes that already exist as part of the primary key.
Solution
Modified the
indexed?method to recognize columns that are part of compositeprimary keys. This prevents false positives while maintaining the original
functionality for single-column indexes.
Example
Given a HABTM table:
Testing
Pointed the repo at this branch and ran the UnindexedForeignKeys command. Has fixed the issue for my repo.