Maven Users:

The db-migration-maven-plugin
<http://code.google.com/p/c5-db-migration/>provides support for
managing project database structure changes over time
(a la rails migrations).  Each change is captured as a discrete migration
(implemented in SQL or Groovy).  A history of which migrations have been
applied is stored in the database (table schema_version) and all pending
migrations can be applied using a single goal.  The following goals are
provided by the plugin:

db-migration:newCreate a new, empty migration file (-name=... to include a
name in the filename) db-migration:validateCheck to see if the database is
up-to-date and report pending migrations db-migration:migrateApply all
pending migrations db-migration:createCreate a new, empty database
db-migration:dropDrop the database db-migration:resetDrop the existing
database, create a new one, and apply all pending migrations
The plugin uses sensible defaults for much of its configuration; many
projects can start using the
db-migration-maven-plugin<http://code.google.com/p/c5-db-migration/>with
only the following addition to their pom.xml (MySQL example):

...
<plugin>
    <groupId>com.carbonfive</groupId>
    <artifactId>db-migration-maven-plugin</artifactId>
    <version>0.9.1</version>
    <configuration>
        <url>jdbc:mysql://localhost/myapp_test</url>
        <username>dev</username>
        <password>dev</password>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
        </dependency>
    </dependencies>
</plugin>

<pluginRepositories>
    <pluginRepository>
        <id>c5-public-repository</id>
        <url>http://mvn.carbonfive.com/public</url>
    </pluginRepository>
</pluginRepositories>
...

MySQL, PostgreSQL, and MS SQL Server are pretty well supported while HSQL
and H2 support some of the goals (all but drop, create, and reset).
Themigrategoal may work on Oracle, but
create/drop/reset do not and I don't plan on adding support any time soon
(sorry).

The project is hosted on google code:
http://code.google.com/p/c5-db-migration/

We've been using this plugin on real projects at Carbon
Five<http://carbonfive.com/>(my company) for close to a year and many
other developers are using it as
well.  My goal is to release a 1.0 version in the next few months, after a
wider range of folks have given it a try and any remaining kinks are worked
out.

Give it a try and please feel free to give me your feedback.
Christian
-- 
Christian Nelson - Carbon Five (http://carbonfive.com)

Reply via email to