java rake db:migrate implementations

I was surprised that there were so many libraries that do the same thing — manage change inĀ  your database schema. Here’s what I’ve found so far:

  • Liquibase (migrations are specified in db-generic XML)
  • migrate4j (migrations must be writted in java, and has “down” and “up” support)
  • AutoPatch (“down” and “up”, with both .sql and .java support)
  • dbmigrate (no “down” — only “up”, with both .sql and .java support, but no test coverage)
  • c5-db-migration (nice integration with maven)

I’ve used a heavily patched version of dbmigrate on my last project at work, and it’s doing what it’s supposed to. I’ve only read documentation for the other projects.

Update March 2010:

dbmigrate is abandonware that doesn’t have any unit test coverage. I’d suggest looking at c5-db-migration.

Related posts:

  1. Java for Mac OS X 10.5 Update 1 adds support for Java SE 6
    Java for Mac OS X 10.5 Update 1 adds support for Java SE 6 Update: Apple’s java6 port can’t run IDEA… Back to java5. :-\......
  2. java.beans.XMLEncoder Considered Harmful
    To all java engineers out there: Before you even think about using java.beans.XMLEncoder and it’s sibling, XMLDecoder, make sure you verify two things: Are you OK with your application running......
  3. Simple spring integration testing
    Spring has had a really nice unit test framework available for a while now, but the documentation can be a bit daunting. Here’s a super-simple example of adding dependency injection......
  4. Set up JAVA_HOME to track Java Preferences.app on Mac OS X
    Mac OS X’s Java Preferences.app has a pane for switching between versions of the JDK, but I just found out from a coworker (thanks, Mike!) that you can make your......

This entry was posted in Technical HOWTOs and tagged . Bookmark the permalink.

2 Responses to java rake db:migrate implementations

  1. mario says:

    Which one do you suggest to add indexes to a database automatically generated by Hibernate?

  2. matthew says:

    I don’t know of any dbmigrate libraries that integrate with hibernate — if you find one, I’d love to hear about it.

    What you can do is generate the schema automatically with hibernate using the hbm2ddl functionality, then copy that DDL into your dbmigrate scripts, adding whatever you need (like indexes).

    For unit tests of the hibernate wiring I normally use h2, but when there’s SQL in your DAO, you should test with the database engine you’ll use in production.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Additional comments powered by BackType