Closed jdufresne closed 2 months ago
These will be false positives most of the time, because the next step in migrations will be validation for these and the validate
will be removed then. So it will stay not a long time in the schema.rb
and lead to violations and disabling of it in the gems config file.
These will be false positives most of the time, because the next step in migrations will be validation for these and the validate will be removed then. So it will stay not a long time in the schema.rb and lead to violations and disabling of it in the gems config file.
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: https://github.com/rails/rails/pull/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-key