Upgrading Liquibase

Before upgrading Liquibase, read the latest release notes for any changes that may affect your existing setup. Once you have reviewed the Release Notes page, follow the download instruction for your operating system on the main Liquibase Installation page, and then verify your changes by following this instruction.

Verifying changes

Verification #1: Check your PATH to Liquibase

To verify that you have correctly added the Liquibase folder to your PATH after the upgrade, type env in your Linux Terminal or Windows Command Prompt to display all available PATHs.

Verification #2: Check for Java installation

For Liquibase to run correctly, Java must be installed on your Linux, Unix, or macOS operating system. To verify that Java is installed on your computer:

  1. Open your Linux Terminal or Windows Command Prompt.
  2. In the command line window, type java -version.
  3. If you see the error message: "-bash: java: command not found", "'java' is not recognized as an internal or external command, operable program or batch file", or "java : The term 'java' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again", then you need to install Java or add the location of the Java executable to your PATH.

    To install Java on your computer:

    • Go to the Oracle download site or java.com and install the needed version of Java.
    • Add the location of the Java executable to your PATH environment variable. You can find more information about adding Java to the PATH for Windows, Linux, Unix, or macOS on the main Liquibase Installation page under the Manual installation section.

Verification #3: Run the Liquibase help command

Another way to verify that you installed Liquibase correctly on your computer is to run the Liquibase help command. To run the command:

  1. Open your Linux Terminal or Windows Command Prompt.
  2. Run the following:
  3. liquibase --help

Troubleshooting

  • If you cannot run the Liquibase help command, verify that you have correctly installed Java. Also, ensure that the Liquibase folder you downloaded is set to your PATHs.
  • If you have installed Java, however, you are still receiving an error, add Java to your PATHs using the steps provided in the Verifying section for your operating system.

Verification #4: Run the Liquibase version command

To verify that you upgraded Liquibase to the expected version, run the Liquibase version command.

  1. Open your Linux Terminal or Windows Command Prompt.
  2. Run the following:
  3. liquibase --version

Troubleshooting

  • If you still see the old version of Liquibase, ensure that the new Liquibase folder you downloaded is set to your PATHs.
  • If the PATH is pointing to the new version, then you may need to restart your command line to load the new PATH.

Verification #5: Run the Liquibase validate command

To verify that your existing project changelogs are compatible with your current projects, you can run the Liquibase validate command.

  1. Open your Linux Terminal or Windows Command Prompt.
  2. Run the following:
  3. liquibase validate

Troubleshooting

  • If the validate command produces an error on a specific changeset, examine your changelog carefully. There may be situations where you have fixed a bug, and now you need to check syntax issues.
  • If you are testing a new feature within an XML changelog, ensure that the header next to the XSD field has the current version of Liquibase. For example, if the upgrade is for Liquibase 4.3.1:
  • <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" 
    xmlns:pro="http://www.liquibase.org/xml/ns/pro" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation=http://www.liquibase.org/xml/ns/dbchangelog-ext 
    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd 
    http://www.liquibase.org/xml/ns/pro 
    http://www.liquibase.org/xml/ns/pro/liquibase-pro-4.3.xsd 
    http://www.liquibase.org/xml/ns/dbchangelog 
    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd
    </databaseChangeLog>

Best practices

It is a best practice to maintain the consistent naming convention for the directory where you install Liquibase.

Your latest version could be installed in the C:\Apps\Liquibase directory on Windows or /opt/Liquibase directory on Linux, and directories for older versions could be named as follows:

  • C:\Apps\Liquibase_4.0.0 on Windows or /opt/Liquibase_4.0.0 on Linux
  • C:\Apps\Liquibase_4.2.1 on Windows or /opt/Liquibase_4.2.1 on Linux
  • C:\Apps\Liquibase_4.3.1 on Windows or /opt/Liquibase_4.3.1 on Linux

Related Links