rails/rails — Issue #5030: db:migrate:redo leaves schema.rb in incorrect state
Author: jleven
Created: 2012-02-13 21:29:29+00:00
State: open

The rake task db:migrate:redo is implemented as:

````ruby
task :redo => [:environment, :load_config] do
if ENV['VERSION']
db_namespace['migrate:down'].invoke
db_namespace['migrate:up'].invoke
else
db_namespace['rollback'].invoke
db_namespace['migrate'].invoke
end
end
````

Each of these rake tasks invokes `db_namespace['_dump'].invoke` but because these are rake tasks, only the first invocation is executed. This leaves the schema.rb file in the state between the rollback and migrate (or between the down and up).

A simple fix would be to have each of these tasks call `db_namespace['_dump'].execute` to ensure the _dump task is always invoked.