This project is archived and is in readonly mode.
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
-
Repository February 6th, 2009 @ 12:48 AM
- 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 state:committed] http://github.com/rails/rails/co...
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
- Nobody is watching this ticket.
Attachments
Referenced by
- 1412 db:migrate:redo does not dump the schema after migrating back up Signed-off-by: Michael Koziarski michael@koziarski.com [#...
- 1209 'rake db:migrate:redo' fails to update schema.rb Fixed on #1412