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

Rake task for manually running validations across all models and records #2162

Merged
merged 2 commits into from
Oct 9, 2018

Conversation

kevinrobinson
Copy link
Contributor

@kevinrobinson kevinrobinson commented Oct 9, 2018

In the work for #2156, it came up that there are models in the database that violation validations. This can happen when we add a validation, ship it, and then don't load that model into memory. This is one reason why database constraints are stronger than validations (if violated, they'll raise when adding the constraint).

Work in #2160 should help with adding more constraints, but this adds a one-off task for running all validations on all models and records. I'll run this now to verify there are no other gaps, and potentially schedule it to run and raise weekly if anything gets through. This task will probably be quite slow (Rails presence validations for associations trigger queries to verify that the record is present, even if a database foreign key constraint is present). We could speed this up by ensuring we have foreign key constraints (which immigrant enforces) and changing Rails presence validations on the association to just be presence validations on the key column, or by replacing uniqueness validations with database constraints, but let's see how long this takes first and if we can just run it weekly.

@kevinrobinson kevinrobinson changed the title Feature/one off rake task for validations Rake task for manually running validations across all models and records Oct 9, 2018
@kevinrobinson kevinrobinson force-pushed the feature/one-off-rake-task-for-validations branch from ec7e225 to f7e748c Compare October 9, 2018 12:34
@kevinrobinson
Copy link
Contributor Author

selfie

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.

None yet

1 participant