Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#1412

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.

Reported by Will Bryant · November 19th, 2008 @ 10:01 AM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Roger Nesbitt
  2. Repository
    Repository
    • State changed from new to committed

    (from [ba146a84d0ed8a886fdc6b6794ce99a9d37c0190]) re-enable db:schema:dump so db:migrate:redo dumps the schema after migrating back up

    Signed-off-by: Michael Koziarski michael@koziarski.com [#1412 db:migrate:redo does not dump the schema after migrating back up state:committed] http://github.com/rails/rails/co...

    February 6th, 2009 @ 12:48 AM