This project is archived and is in readonly mode.

#1412 ✓committed
Will Bryant

db:migrate:redo does not dump the schema after migrating back up

Reported by Will Bryant | November 19th, 2008 @ 10:01 AM | in 2.x

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.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket


Referenced by