precondition <sqlcheck> is not working for schema

Hi,

I want to have "IF NOT EXIST" functionality for my schema creation in Oracle. I am using liquibase for ddl and spring boot application.

  SELECT COUNT(1) FROM dba_users WHERE USERNAME='ABC'   CREATE USER ABC IDENTIFIED BY ABC DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS TEMPORARY TABLESPACE TEMP QUOTA 5M ON system PROFILE DEFAULT   

This is not working. But without user is created, but I need 'IF NOT EXIST' .

We are writing a micro service in spring boot so that we want to have separate schema for our micro service which will be created / initialized with in our service.

Can anyone help me here.

Thanks

Senthil

Thanks Ronak.

Its my mistake.  ChangeSet is executing after adding the property runAlways=true. 

I am using SpringBoot application, so I will restart and check the application often.  So, without runAlways it is expected behaviour . Now it is fine.

I am having another issue now.  clearChecksum is not working.

I have added in my pom.xml like below

   
                org.liquibase
                liquibase-maven-plugin
                3.8.8

               
                   
                       
                            clearCheckSums
                       
                   
               
               

Can you provide your suggestion here.

Thanks

Senthil

I am getting below exception sometimes, I am not sure about the scenario exactly when I am getting this error.

]: Invocation of init method failedFailed: 1 change sets check sum https://stackoverflow.com/questions/34655157/how-to-solve-liquibase-checksum-validation-fail-after-liquibase-upgrade/34661256

That is what I am trying to do.

Please suggest my approach is correct or not ?

Note : I am not getting checksum error now, If you need the same to fully
understand please let me know, I will try to reproduce and post it here.

Thanks
Senthil

If not exists, and other flow control logic are not valid ddl statements to converted into xml using the ddl workflow.  This is because the ddl is created as a comparison between 2 states of the database.

If you need the flow control then you may want to use sqlfile change type.

Hi Senthil!

Could you show me the output?  I don’t what you mean by:

clearChecksum is not working.

Thanks!

Ronak

Hi Senthil,

The checksum error may sometimes happen if you are using differ versions (at least that’s the way it works with Datical, which is built of liquibase).

You are correct that clearchecksum is a decent immediate solution but, it is more important to understand why this happens in the long run.  For example as mentioned above, what version of Liquibase are you using?  Is it the same version on all systems?

Thanks!

-Ronak