Wysmedia.com

Icon

~ We make IT easy for you ~

Using Liquibase (tutorial)

Liquibase is the powerful database migration that available for free. For long time I am envy of rails database migration system. It is nice and have rich features.

Few weeks ago, I found that Grails has Liquibase plugin (there are 2, liquibase and autobase). I tried both plugins and autobase won my heart because the simplicity they offer (not using XML is the biggest advantages, for me at least). Liquibase however build as stand alone java application that you can run with any operating system that support java.

Here I will show you how to configure and using Liquibase on command line, so you can apply whether you are using php, python, or others programming language/framework

Read the rest of this entry »

Autobase plugins

Sometimes, we need to refactor our domain / database table.  For example, our first domain looks like this :

1
2
3
4
class Person {
String personName ;
BigDecimal monthlyIncome ;
}

Now we want to eliminate/change the monthlyIncome and replace it with BigDecimal weeklyIncome

we type

1
2
3
4
class Person {
String personName ;
BigDecimal weeklyIncome;
}

But, when we look at the table, it still have monthlyIncome field. That’s why we need to eliminate it. If we works as a team, this could be a messy and troublesome, because monthlyIncome is not nullable. So it produce error (JDBC errors) when someone tried to update or save into that table.

That’s why we need Autobase for this dirty job. Autobase is Grails plugin that created base on Liquibase. Liquibase, however using xml format to do database migration. I hate to write on xml actually.
Luckily, Robert Fischer, wrote this useful Grails’s plugin, so that we can write it using Groovy DSL.
Read the rest of this entry »