Is there a way to resolve Rails deleted migrations?

If you can find the migration's timestamp - the number part of the filename, then you can do:

rake db:migrate:down VERSION=20100905201547

You can find the timestamp using rake db:migrate:status

Edit - when the migration file has been irrecoverably deleted

You can get around this by creating an empty migration file, migrating, then rolling back twice. Then, make sure you delete the empty migration file before migrating again.

$ bundle exec rails g migration fix_rollback_error
$ bundle exec rails db:migrate
$ bundle exec rails db:rollback STEP=2
$ rm db/migrate/20200217040302_fix_rollback_error.rb
$ bundle exec rails db:migrate

Alexander, you can get rid of those non-existing migrations. when you do rake db:migrate:status it will show as in the question.

so you can manually delete those versions from schema_migrations table using a pure sql query.

delete from schema_migrations where version = <version_number> by executing above query, it will be resolved.