Skip to content

Prevent primary keys from being flagged by "Hide foreign" keys rule#371

Open
emil-eklund wants to merge 1 commit intomicrosoft:masterfrom
emil-eklund:master
Open

Prevent primary keys from being flagged by "Hide foreign" keys rule#371
emil-eklund wants to merge 1 commit intomicrosoft:masterfrom
emil-eklund:master

Conversation

@emil-eklund
Copy link

Fixes #234

Very noticeable in agentic workloads where primary keys are often hidden without regard for legitimate use-cases.

Copilot AI review requested due to automatic review settings February 27, 2026 09:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the "Hide foreign keys" BPA rule that was incorrectly flagging primary keys in addition to foreign keys. The issue occurred because the rule only checked if a column name matched the FromColumn name in any relationship with "Many" cardinality, without verifying that the column actually belonged to the FromTable (many-side) of the relationship.

Changes:

  • Updated the HIDE_FOREIGN_KEYS rule expression to add a table name check, ensuring only foreign keys (not primary keys with the same column name) are flagged

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

BPA Rules: Hide foreign keys update

2 participants