Fix `bin/rails db:migrate` with specified `VERSION`
#30714

bogdanvlviv wants to merge bogdanvlviv:fix-rails_db_migrate_VERSION into rails:master

We do not currently have an analysis of these two commits