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