Creating a table with liquibase xml using api java with context defined not working

If there was some sort of error, I am pretty certain that the liquibase.update() method would throw an exception. If it is not, then Liquibase believes it is operating ‘as designed’, so the likelihood is that the problem is with the state of the changelog vs. the state of the database. 

There is another API you can use to see what the status is for all of the changesets - if you call liquibase.getChangeSetStatuses(contexts) you will get back a List that you can iterate over and see what is happening. 

Steve Donie
Principal Software Engineer
Datical, Inc.

I’d like to help you, but you aren’t giving me much information to work with. What you want to do seems completely possible - it is exactly what Liquibase is designed to do.

So - what is the ‘willRun’ value of each of your changesets? What is the dateLastExecuted? Since you are writing your own code and using the API, maybe you could try debugging through it to see what it is doing.

Steve Donie
Principal Software Engineer
Datical, Inc.

I need update my database with new changesets of one especific context. When a run my code, the liquibase runs normally, but the table is not created. Nothing error is showed, so it is very difficult to understand the problem. What do I doing wrong?

My code is:

liquibase.update( "TEST" );

Like a said, the liquibase runs but don't create my table from xml. I am using 3.4.1 for liquibase and java 8.
Thanks so much Steve, you was very fast!

First, let me to explain the cenario that I am developing. I am buiding a graphic interface that choose a database, a context tag and the rotine from liquibase (update, rollback) to run. I choose all the params and the new changes are running in the database choosed.

I used the API that you told me:


So, the code threw eighteen lines, the number of all my changesets exactly. The last line (changeset), it is the one that I want to run because of the context that I choosed on interface.

The cenario what I want, is it possible?


Hi Steve,

I discovered what was the problem! Debugging, I gave pass the wrong context to the liquibase! So, now it works normally.

Thanks for your help.