Fork me on GitHub

n. Slang a rough lawless young Kuali developer.
[perhaps variant of Houlihan, Irish surname]
kualiganism n

Blog of an rSmart Java Developer. Full of code examples, solutions, best practices, et al.

Wednesday, September 12, 2012

Liquibase CustomChange for Migrating Across RDBMS

Overview

While there's now an Ant implementation and a Maven plugin devoted to copying databases across RDBMS platforms, the plan has always been to be supportive of the liquibase core and to use liquibase custom refactorings for as much as possible. Right now, the Rice project is working on a fork of liquibase. Much of what Kuali needs is outside the scope of liquibase and contrary to the direction they want to go.

Maintenance effort can be reduced by developing necessary functionality as extensions which is why I chose this approach. I am developing everything as an extension of liquibase and posting it on the web and in forums. If others find it useful, a liquibase Jira issue can be created for implementing the extensions in the core. Then, "Why the reimplementation of Ant and maven plugins?" My answer is plainly that liquibase as it is now does not support the use cases that I want.

  • Database Migration and copy
  • Clover and Pentaho change management/integration
  • Ruby-on-rails-ish migration
  • Simple developer change testing

It's not that liquibase does any of those things differently, but that they simply don't exist. The direction of the product is not leaning toward any of those features. It is database change management on the simplest level. However, they have created an awesome and useful extension system that allows me to add in the pieces I need.

That all being said, I am creating liquibase extensions that will get me the functionality I am looking for simply by using liquibase, ant, or maven. Some of it I have already shared with the Rice Liquibase Extensions.

MigrateData Custom Change

I have now made another one for migrating data across RDBMS platforms.

Using it

This is not so bad. You basically want to:
  1. Add kualigan liquibase extensions to your maven project.
  2. Create a change
  3. Run it with liquibase


1 Add Kualigan liquibase extensions to your maven project




Likewise, I need to add my credentials for the target database into src/main/resources/liquibase/



You can also learn more on GitHub.

2 Create a change

This is pretty easy. It's just a normal liquibase change.



It may not make sense at first that there's only a source specified. The reason for this is that the target is always where liquibase is applying the change. It does not need to be specified because liquibase already knows about it.

3 Run it with liquibase

Personally, I prefer the maven tooling, so I'm going to use that:



That's it

Enjoy

No comments:

Post a Comment