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

Report unique constraints with missing Rails validations #39

Open
olliebennett opened this issue Feb 13, 2017 · 1 comment
Open

Report unique constraints with missing Rails validations #39

olliebennett opened this issue Feb 13, 2017 · 1 comment

Comments

@olliebennett
Copy link

This is the opposite behaviour of the gem, but it seems it would be useful to identify instances in which the unique constraint is defined at the database (schema) level, but not specified (eg via uniqueness: true) in the Rails model.

This could be an additional check which happens only if specified by a command-line option when executing consistency_fail, so as not to break backwards compatibility and to avoid reporting on these problems if not required. Some models may deliberately omit the validation in Rails, for instance (perhaps for performance reasons).

Does this sound like it'd be useful?

@trptcolin
Copy link
Owner

Generally speaking, yes! The tricky piece is that has_one is another valid place to want a constraint, so I think I might want that to be detected too?

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

2 participants