Column Exists Precondition - Dropping Column

I am using below change set with precondition to verify whether the column exists or not.
But it always throws an error during the changeset execution and the changeset is not being skipped.

Please advise, if the configuration is valid.

I’m not able to view the changeset.

Hi Daryldoak, Can you able to see the changeset now, please?

ok, if I click “edit” on your post I can see it. Can you also provide the error you are getting?

when i am trying to bring up springboot application with executing the changeset, it realize the dropping column is missing in table and failed to start the application,


aused by: liquibase.exception.DatabaseException: ERROR: column “user_name” of relation “test” does not exist [Failed SQL: (0) ALTER TABLE user DROP COLUMN user_name]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement( ~[liquibase-core-4.21.1.jar:na]
at liquibase.executor.jvm.JdbcExecutor.execute( ~[liquibase-core-4.21.1.jar:na]

So, I like to skip the changeset if the column is not in the table, so that the application will come up.
Please advise,

You appear to have omitted the schemaname from the precondition:

  <preConditions onFail=MARK_RAN>
      <columnExists tableName=user columnName=user_name/>

I think you need to match the properties set in the precondition exactly with the properties set in the drop column, like this:

<changeSet id=DropColumn author=test>
  <preConditions onFail=MARK_RAN>
      <columnExists tableName=user schemaName=test columnName=user_name/>
  <dropColumn tableName=user schemaName=test columnName=user_name/>

I even tried with schema name but still no luck with that,
but, i modified the precondition to skip the change set if the column is not there to drop, it works seems, any more suggestions with this !?

<changeSet author="id" id="DropColumn"> 
  <preConditions onFail="MARK_RAN">
      <columnExists tableName="users" schemaName="test" columnName="user_name"/>
    <dropColumn catalogName="users"  
        <column name="user_name"/>