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

detecting missing has_many declarations? #247

Open
alexfiennes opened this issue Jan 7, 2025 · 0 comments
Open

detecting missing has_many declarations? #247

alexfiennes opened this issue Jan 7, 2025 · 0 comments

Comments

@alexfiennes
Copy link

If I have a source table that declares a belongs_to relationship with a target table and this is declared as a foreign key on the database but we have not declared a corresponding has_many or has_one with a dependent: clause, then deleting a source record will cause SQL errors because the foreign keys will no longer be valid.

Is this a situation that can be detected by database_consistency? I had thought that ForeignKeyCascadeChecker might do this, but it appears to be only covering situations where the db is not duplicating cascading deletes for non-destroy methods.

If it isn't covered then are you aware of any other tools that might be able to report on this potential issue?

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