In association with heise online

Early planning is half the battle

However, these are the only major differences that are worth mentioning. Otherwise, both frameworks can be considered equal and their differences only marginal in terms of features and concepts, and it will be up to the individual developer or team to decide which of the frameworks to use.

In both libraries, profiles can control separate sets of changes for execution in different environments (development, test, integration etc). For example, developers can stipulate that in the integration environment, the database will be emptied completely (data and structure) before a new deployment, and that it will then be rebuilt for the test data to be added from scratch. An execution in the staging environment, on the other hand, will only change the delta structures that have accumulated since the previous deployment and may perhaps run a few transformation scripts to adjust the data to the new structure.

Ideally, the use of Liquibase or Flyway is planned and configured in a project before development begins. This allows developers to start with an empty database and scripts/XML for creating a schema and objects. However, scanning the database with the tools and generating an initial database configuration is also not problematic. This initial configuration is then checked into the VCS and used as a starting point for any further development work. From then on, versioned development can simply continue as if the project had used the libraries from the beginning.

Conclusion

A versioned database is a must for every functioning continuous deployment project. It is the only way to ensure, without major effort, that all developers can generate and work with the current or applicable database state that matches the application state. The distribution into target versions also helps production run versioned databases too.

Flyway and Liquibase are two open source libraries that handle database versioning and can also be used outside of Java environments. Both tools deal with the versioning of structural changes and the transformation of existing data and can generate, and respond to, a database "diff" between the existing and the target database state. The use of the libraries enables developers to version their database and ensure that an application is executed flawlessly, but a database description that is included in the version control system also provides good documentation of the database itself – an aspect that is criminally neglected far too often.

In the author's opinion, Flyway is slightly more "lightweight" and has a slightly smaller footprint than Liquibase. The XML configuration detour in Liquibase is a matter of preference. In any case, both are powerful libraries and no project should be without them.


Niko Köbler is a freelance consultant and software architect for Enterprise Java, integration projects and web services. He conducts workshops and training and carries out architecture reviews. He also co-organises Java User Group Darmstadt (JUG DA) and is a regular speaker at industry conferences.

Print Version | Permalink: http://h-online.com/-1860080
  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit
 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit