Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissingForeignKeys detector assumptions #94

Open
fatkodima opened this issue Apr 3, 2022 · 0 comments
Open

MissingForeignKeys detector assumptions #94

fatkodima opened this issue Apr 3, 2022 · 0 comments

Comments

@fatkodima
Copy link
Contributor

The checker makes an assumption that foreign-key like columns should be in the form of ..._id.

It can:

  1. lead to false positives, when some table have some column ending with _id which is not a reference to other table, but, for example, some id from the external resource (users.stripe_id).
  2. miss some custom named foreign keys: belongs_to :user, foreign_key: :user_key

I think, what should be really checked are models having non-polymorphic belongs_to associations without foreign keys.

Checking only models would make it easier to also ignore the case, when underlying models belong to different databases.

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

No branches or pull requests

1 participant