4.21.1 is out, deprecates Liquibase.update()

Yeah, that javadoc could be improved. “Use CommandStep” is not really even the right answer for most people. Also the versions with Writer should either be deprecated now or will be soon. We aren’t planning to actually remove the methods for a while, but still good to shift to the newer APIs when you can

The replacement for the Liquibase class in general is the liquibase.command.CommandScope class. command.CommandScope - contribute.liquibase.com gives some more information on it. We are creating that class vs. the original Liquibase facade to be flexible enough to work with everything Liquibase can do now and is looking to do in the future. A static list of methods and arguments just wasn’t cutting it anymore.

Your new version of liquibase.update() will be more like:

   try {
            new CommandScope("update")
                    .addArgumentValue("changeLogFile", "my/changelog.xml")
                    .execute();
        } catch (CommandExecutionException e) {
            System.out.println("Error running update: "+e.getMessage());
        }

Nathan

1 Like