db:migrate:redo is implemented as db:migrate:down+db:migrate:up
or db:rollback+db:migrate.
Each of those four subtasks does a db:schema:dump at the end.
However, this being rake, if db:schema:dump has already been run,
it won't run again (Task#invoke, surprisingly, is just like a
prerequisite in that respect).
End result, the db:migrate:down or db:rollback will dump the
schema, and the db:migrate:up or db:migrate won't, so your schema
is left inconsistent with the migrated state. Quite confusing...
the db doesn't clone properly for test, and further redos further
bork the state.
The attached one-line patch makes db:schema:dump call reenable
on its own task definition, so that it may be called invoked
multiple times, which should fix this problem and any similar
issues with people's own "combo" tasks calling db:schema:dump
multiple times. Applies to both 2-2-stable and master.
Task#reenable was introduced in Rake 0.8.2, but we already
require Rake 0.8.3 for Rails 2.2 so no problem there.