LiquiBase Core 1.5.0 Released

LiquiBase Core 1.5.0 is now available for download from http://www.liquibase.org/download

1.5.0 includes a major refactoring which should not affect most users except for the following items:

BREAKING CHANGES


  • Servlet Migrator: The web.xml parameter names have changed. See http://www.liquibase.org/manual/servlet_listener for more information.
  • If you used the “database.migrator.should.run”, it is must now be changed to “liquibase.should.run”
  • If you have extended or embedded LiquiBase classes or calls directly in your code, changes will be necessary.

BACKWARDS-COMPATIBLE CHANGES


  • Servlet Migrator: The classes to reference in web.xml have changed to liquibase.servlet.LiquibaseStatusServlet and liquibase.servlet.LiquibaseServletListener. The old classes are now simply subclasses of the new and are deprecated so they should work.
  • Spring Migrator: The class to reference in your spring config has changed to liquibase.spring.SpringLiquibase. The old class still exists as a subclass of the new so existing configurations should continue to work.
  • Command Line: The “migrate” command has been changed to “update”.
    “migrate” is now an alias for “update” so existing calls should continue to work

ENHANCEMENTS


IMPROVED SCHEMA SUPPORT
There is now a “defaultSchemaName” parameter available for setting default schema. This schema will be used for all ambiguous database objects as well as for storing the databasechangelog and databasechangeloglock tables.

IMPROVED ANT TASKS
Ant support has been greatly expanded and now covers most of the functionality available in the command line application. See http://www.liquibase.org/manual/ant for more information.

NEW COMMANDS

  • changeLogSync
  • updateCount
  • updateCountSQL

NEW REFACTORINGS

OTHER CHANGES


  • Custom Database implementations can be specified with the databaseClassName parameter
  • “replaceIfExists” attribute added to createView
  • createTable can specify uniqueConstraintName
  • Setting value/valueNumeric/valueBoolean/valueDate on addColumn will update all existing rows with the given value
  • Database table comments saved to generated change log
  • Changelog file comparisons are case-insensitive on windows
  • Output warning of old schema version
  • Added comments tag to generated SQL output
  • Rollback commands can specify contexts
  • XSDs are not pulled from network
  • Handles Postgres datatypes better
  • Bug fixes

Upgrading


Upgrading is simply a matter of replacing the liquibase.jar file. To take advantage of newer change log features, change your XSD declaration to:
<databasechangelog xmlns=”http://www.liquibase.org/xml/ns/dbchangelog/1.5″
xsi=”http://www.w3.org/2001/XMLSchema-instance”
schemalocation=”http://www.liquibase.org/xml/ns/dbchangelog/1.5
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.5.xsd”>

Depending on feedback received from this release, the 1.5.0.0 releases of the various plug-ins (Maven, Grails, IntelliJ, Eclipse) should be released over the next few days.

As usual, be sure to let us know if you have any questions or issues.

4 Comments

  1. Duke:

    Hi there Nathan. I’ve downloaded the Liquibase 1.5.0 library and have also included it in my current project as I’ve been expecting some of the bug-fixes since 1.4.1. I used to be able to execute the following Java code snippet, but now that doesn’t run any more. I have not found any documentation yet, but I have realised that the Migrator class no longer exists. Is that correct?
    Anyway, here’s the code that won’t run. Any ideas?

    try
    {
    Class.forName(jdbcDBdriver);
    Connection connection =
    DriverManager.getConnection(
    dbUrl,
    txtfldUser.getText(),
    new String(
    passwordField.getPassword()));

    Migrator migrator =
    new Migrator(xmlFileName,
    new ClassLoaderFileOpener());
    migrator.init(connection);
    migrator.setMode(
    Migrator.Mode.EXECUTE_MODE);
    migrator.migrate();

    }
    catch (Exception e)
    {
    System.out.println(
    e.getMessage());
    }

  2. Nathan Voxland:

    We did some fairly major refactoring, especially around the Migrator and XML parser classes.

    The liquibase.migrator.Migrator class has been moved to liquibase.Liquibase as it is now mainly a facade around the entire LiquiBase engine, rather than just for migrating the database.

    The interface to it has also been cleaned up considerably, your code should now be something like this:

    try
    {
    Class.forName(jdbcDBdriver);
    Connection connection =
    DriverManager.getConnection(
    dbUrl,
    txtfldUser.getText(),
    new String(
    passwordField.getPassword()));

    Liquibase liquibase =
    new Liquibase(xmlFileName,
    new ClassLoaderFileOpener());
    liquibase.update(null);

    }
    catch (Exception e)
    {
    System.out.println(
    e.getMessage());
    }

    Let me know if you have any troubles.

  3. Duke:

    Yep. Thanks for that. There are certainly less errors, however, a ‘Database’ parameter seems to be necessary for the Liquibase constructor. From the JavaDocs I see that a Database object can be constructed with one of the subclasses of that interface (e.g. MSSQLDatabase) to which I pass a connection. I will attempt that. If there is anything I’m missing, please do not hesitate to rectify.
    Thanks for you continued excellent assistance.
    Duke.

  4. Nathan Voxland:

    Sorry, I missed that part.

    The easiest way to get the correct database object is:

    Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection);

Leave a comment