always-drop-instead-of-replace is a Boolean global parameter. If set to true, Liquibase always drops and recreates a view instead of replacing it. The parameter only affects PostgreSQL databases. The default value is false.


You can create a view in your database with the createView Change Type. If you set the replaceIfExists attribute to true in your changeset, Liquibase uses the SQL statement CREATE OR REPLACE VIEW to create the view. This means that if there is already a view of that name, Liquibase replaces the existing view instead of returning an error.

However, the PostgreSQL implementation of CREATE OR REPLACE VIEW has restrictions on column ordering and data types. If you try to create a new view with the same name as an existing view, but with a different structure, PostgreSQL returns an error. The always-drop-instead-of-replace parameter lets you avoid this error by dropping the existing view and then recreating it.

If you enable always-drop-instead-of-replace on a non-PostgreSQL database, it has no effect.


You can set this parameter in the following ways:

Option Syntax
Liquibase properties file
liquibase.alwaysDropInsteadOfReplace: <true|false>
Global flow file argument (example)
      - type: liquibase
        command: update
        globalArgs: { always-drop-instead-of-replace: "<true|false>" }
Global CLI parameter
 --always-drop-instead-of-replace=<true|false> update

JVM system property (JAVA_OPTS Environment Variable)

Liquibase Environment Variables

For more information, see Working with Command Parameters.

Related links