At the end, digging in this list I found a piece of code that does the work
in a pretty clever way.

Here is the code: http://gist.github.com/102770

Fortunately I am not responsible of rolling back a migration, is a
requirement for the developers at my company. I'll wish luck to them :)

Thanks for the clues.

Jacobo García López de Araujo
blog: http://www.robotplaysguitar.com


On Mon, Apr 27, 2009 at 3:11 PM, Jamis Buck <[email protected]> wrote:

>
> On 4/27/09 4:31 AM, Lee Hambley wrote:
> > Jacobo,
> >
> > You may need to implement something like the following pesudocode:
> >
> >     * http://pastie.org/459506
>
> Be very careful, though, because migrations are not (in general)
> reversible. Specific migrations may be, but the only way to be 100% sure
> of a migration being reversible is to do a complete backup of your
> database immediately before the migration. Then, to reverse the
> migration, "simply" restore the backup. Unfortunately, for databases of
> any relevant size, creating or restoring a snapshot is non-trivial,
> which is why Capistrano doesn't do it by default.
>
> - Jamis
>
> >
> > I don't know how well that might work out, or if there is anything
> > internally that would help, I note the following rake tasks in my Rails
> > 2.2.2 application:
> >
> >     rake db:migrate
> >     rake db:migrate:down
> >     rake db:migrate:redo
> >     rake db:migrate:reset
> >     rake db:migrate:up
> >     rake db:reset
> >     rake db:rollback
> >
> >
> > - Lee
> >
> > 2009/4/27 Jacobo García <[email protected]
> > <mailto:[email protected]>>
> >
> >     I am looking for a way to roll back a migration.
> >
> >     So if I run 'cap deploy:migrations' and something in the app is
> >     troublesome, running 'cap rollback' (with this rollback_migrations
> >     as a hook) will leave the database in the same point that before
> >     running 'cap deploy:migrations'
> >
> >     Is there any common formula to solve this problem?
> >
> >     Thanks in advance.
> >
> >
> >     Jacobo García López de Araujo
> >     blog: http://www.robotplaysguitar.com
> >
> >
> >
> >
> > >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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