-
Notifications
You must be signed in to change notification settings - Fork 56
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
Idea: For Rails 7.1, error when there are foreign keys with validate: false
#169
Comments
These will be false positives most of the time, because the next step in migrations will be validation for these and the |
In my experience, these steps come together within the same PR, just as separate migration files. So at CI time, there will not be a false positive. |
Rails 7.1 added the feature to record
validate
inschema.rb
, see upstream PR: rails/rails#46339My proposal is that active_record_doctor emits an error when
validate: false
exists. In my experience, this is normally a "code smell" that something went wrong with migrations and they are incomplete.I most often use
validate: false
on the advice of strong_migrations for a zero downtime schema change, but the validation is resolved once all migration riles run. Their docs are at: https://github.com/ankane/strong_migrations#adding-a-foreign-keyThe text was updated successfully, but these errors were encountered: