Integration LiquiBase in a working project

since I liked the project I want to try to integrate it in our projects, yet there are some problems:

  1. We have a large set of sql scripts, written for mysql, which we need to somehow convert them in the xml format. Is there such a tool?
  2. Since we have a few instances, where there are already installed to the latest state. Is there a way for liquibase to identify that they were not installed by using the tool, but manually?
    Or is it better to just create two sets of change-logs (in 2 different xml), for example : preLiquiBase.xml/postLiquiBase.xml…
  3. When having a few liquibase-xml-changesets, is it possible to make liquibase execute the scripts ordered by their id?
    The reason for that is, that we have an internal convention to always name the sqlscripts with the date in YYMMDD-Format + _<>. So we get: 100608_someupdate. So if we have in 2 changesets the updates with ids:
  • set1: 100607_somesql and 100609_someothersql
  • set2: 100608_sql and 100610_sqlsql
    ideally they should get executed in the following order: 100607, 100608, 100609 and 100610.

ps: I am currently looking at,r=1461/CORE/trunk/liquibase-core-jvm/src/main/java/liquibase/integration/spring/ but if someone has an implementation, I would preffer it then to reinvent the wheel.


  1. We have one master changelog file for each version of our software. Each one of them includes the master changelog file of the previous version and the changelogs of the version itself:
    <?xml version="1.0" encoding="UTF-8"?>


Changelogs will be executed in include order and the changesets of each changelog in natural order. When you execute the changelog for version 6.0.9 in this case, it first executes the changelog for version 6.0.8 (6.0.8-001, 6.0.8-002, …) and then the changelog for version 6.0.9 (6.0.9-001, 6.0.9-002).

  1. We did not create changelogs for all of our existing sql scripts. We started using liquibase somewhere during version 6.0.2. But it is possible to sync your database. Use the command line tool and the changelogSync command.

There are many different approaches to beginning to use liquibase in an existing project.  The best way to begin depends a lot on your team and workflow. 

There isn’t a tool that converts custom sql to changelog files, but there is the generateChangeLog command which you can point to an existing up-to-date database and it will generate a changeLog that will create a database in the same state.  GenerateChangeLog uses the liquibase diff tool which does not understand all the database metadata, and so some changes to the changeLog may be required to get it exactly the same as your own database.

You can also use your existing sql files directly from liquibase using the tag listing each sql file, or the tag pointing to the directory containing your sql files and it will run all of them in alphabetical order.  IncludeAll will execute liquibase changelogs as well in alphabetical order, which should work for your existing liquibase changelogs as well.

If there are changeSets that may or may not need to run depending on if they were run pre-liquibase, you can use the tags to check the state of the database to know if they should run.  For example:


The precondition option can be used with the sql file references above as well.

A final option as well would be to make a database backup using whatever database tool you provide and have that be your “pre liquibase” state, then new installs would be a matter of installing the original database then updating from there.