I'm working on my own mini-framework for this, I blogged last year about my
initial work [1] and am currently reworking it to put up on GoogleCode,
going a more annotation based route.
What I initially wrote it for was creating/migrating databases consistently
during tests and deployments (thou I"m getting resistance from coworkers
about doing unattended migrations at deployment time).
The current implementation which I hope to push to GC soon uses annotations
along the line of:
@DataMigration(groupId="foo",artifactId="bar",version=3)
public void handleMigrationOfUserData(MigrationManager mm) {
mm.update("CREATE TABLE blah....");
mm.executeSql(MyClass.class.getResourceAsStream("/mgirations/version-
3.3.0-migration.sql"));
}
The code looks for all classes/methods annotated with @DataMigration and
runs then in order, updating a 'version' and 'version_history' table with
relevant information.
I found just doing it solely with DDL didn't really give me the flexibility
I needed, as at the time some of the migrations needed data to be
recalculated or interpolated - which wasn't readily available in straight
DDL (esp. from Hibernate Schema generation).
Mark
[1] http://www.talios.com/simple_database_migration_processing.htm
On 3/27/07, Tyler Nelson <[EMAIL PROTECTED]> wrote:
Does there happen to be a plugin to handle database migrations for Maven
2.
I was thinking something like what Ruby on Rails does.
If not what are some of the best practices for doing DDL and DML with
maven,
which part of the maven lifecycle have others put this type of behavior?
Thanks,
Tyler