thats one of the things  I love about postgresql, you can wrap
migrations in a transaction, so failed migrations leave the database
in a determinable state.
coupled with this plugin, it makes life easier...

http://www.redhillonrails.org/#transactional_migrations

However (at least with cap 1) if the migration does fail on your
production server during a cap deploy, I think you need to still
manually do a revert of the migration using...

  >  rake migrate VERSION=nnn

on the server, then do a cap rollback, as cap won't do the migration
rollback for you.


On May 8, 6:33 am, Jamis Buck <[EMAIL PROTECTED]> wrote:
> Migrations are tricky beasts, because if they fail halfway through,
> your database will be left with part of the migration applied. Most
> DBMS's will not allow you to do things like table creations or column
> additions inside a transaction, so there is no easy way to atomically
> apply a migration. Thus, Capistrano (by default) does not try to wrap
> your migration inside a transaction.
>
> If things go sour, you can manually rollback:
>
> 1. Determine what parts of your migration succeeded, and manually
> undo those changes in your database.
>
> 2. cap deploy:rollback_code (or, on cap1, just "cap rollback_code")
>
> It is strongly recommended that you thoroughly test your migrations
> in your development and testing environments before you run them in
> production. If possible, get a snapshot of your production data that
> you can use in development to run them against.
>
> - Jamis
>
> On May 8, 2007, at 6:41 AM, dweinand wrote:
>
>
>
> > Hello,
> > i'm just looking for a solution to rollback my app after a migration
> > failed.
>
> > I'd like to run the migration with every deploy command. but if the
> > migration fails, i'd like to rollback to the last version before the
> > migration.
>
> > can i do a "dry run" to check if the migration is ok? or do i have to
> > deploy the application, call the migration and if the migration fails
> > rollback the whole thing?
>
> > how can i determine if the migration failed? just tried with an
> > transaction but i think i missunderstand there something.
>
> > regards


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to