ChangelogDatabase table exists?

Hi Team,

I am exploring Liquibase for my learning for database automation deployment. I am stuck with an issue, can you please assist me on it.

  1. I have manually created the changelogdatabase table and lock table, now when I ran the “mvn liquibase:update”, it give me an exception mentioning the object is already exist. How can I handle this exception?
  1. Also, We have other use case, where we create the changelogdatabase by defining its custom name in pom.xml. Now Whenever I uses command “mvn liquibase:update” its throwing me exception. When I uses “mvn liquibase:updateSQL” it say done successfully but nothing is update my database.

Can you please assist where are doing wrong. Thanks in Advance.

Hi Sangwan,

  1. you do not need (and probably should not) create the liquibase tables on your own. Liquibase will do that for you on it's first run, where something needs to be logged. Anyways one common problem may be that liquibase does not see the tables because it has not the required access rights.
  2. For the second part of your question, the liquibase update command is actually interacting with the database and doing work, this is where things can fail. The updateSQL command on the other hand is just generating the sql liquibase would execute to your database, but it is actually not doing anything. updateSQL is intended for environments where other authorities have to double check the sql before executing it (e.g. by the DBA).

Hope that helps.

kind regards

Daniel

Thank you Daniel for the response.

I have some following questions:

  1. I have define custom name for change log table in POM.XML (assume in properties file case as well). It works successfully, but when I run the same from other match using same POM file, it throws exception. But thats not the case with default change log table name. 
  1. As you mentioned, "

Hi Sangwan,

was mentioned in my first answer, without a copy of the error you get, maybe more information about the database system you actually use and a copy of your configuration there’s not much help anyone can give you.

A pretty common problem is that the tables you already created, are restricted to be seen by another user than liquibase uses to connect to the database. 

So try to connect to the database with the same user as liquibase does and select from the databasechangelog table works.

Double check that the structure you created is identical to what liquibase would create in a fresh instance.

Also make sure the user liquibase uses has the rights to create alter and maybe drop database structures.

kind regards

Daniel