Search code examples
migrationcamping

Can Camping handle rollbacks?


I wrote a migration and migrated to it (on a dev copy, of course) before realizing I forgot to initialize a value, then puzzled for the next ten minutes over how Camping might make it possible to rollback. I realize I can just write another migration to fix the data, which is what I intend to do, but it begs the question:

Can I rollback a migration in Camping, or do I have to rely on writing an X.1 any time I miss something?


Solution

  • You can tell App.create_schema what version to migrate to:

    Camping.goes :App
    
    …
    
    App.create_schema(:version => 1.1)
    

    Note that you'll have to define down-migrations (or use change-migrations) for this to work.