We're updating the issue view to help you get more done.Β 

Error when using dropAll and update twice in different schema

Description

Hi,

As a developer, I really often use the following command line to reset my database and replay all changes

1 mvn clean liquibase:dropAll liquibase:update

Unfortunately, we choose to move our application table in a specific schema `FOO` for this example.

In our only changelog file, we have this:

1 2 CREATE SCHEMA IF NOT EXISTS FOO; CREATE TABLE IF NOT EXISTS FOO.BAR (...);

My maven parameters are the following:

1 2 3 4 5 6 7 <changeLogFile>src/main/resources/db/changelog.xml</changeLogFile> <driver>org.postgresql.Driver</driver> <url>${database.url}</url> <username>foouser</username> <password>${database.password}</password> <databaseChangeLogTableName>propagation-changelog</databaseChangeLogTableName> <databaseChangeLogLockTableName>propagation-changeloglock</databaseChangeLogLockTableName>

If I run the command `mvn clean liquibase:dropAll liquibase:update` on clear database, all is OK. But If after that I run `mvn clean liquibase:dropAll`, the execution ends in success but table `FOO.BAR` still exists πŸ˜“

If I put the value `<defaultSchemaName>foo</defaultSchemaName>` in the maven config and run on a clean (real empty) database the command `mvn clean liquibase:dropAll liquibase:update`, it ends with success. But if I run this same command another time, without any modification, it ends in failure.

1 [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.6.3:dropAll (default-cli) on project subscription-management-propagation: Error setting up or running Liquibase: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: ERROR: relation "propagation-changelog" already exists [Failed SQL: CREATE TABLE "propagation-changelog" (ID VARCHAR(255) NOT NULL, AUTHOR VARCHAR(255) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED TIMESTAMP WITHOUT TIME ZONE NOT NULL, ORDEREXECUTED INTEGER NOT NULL, EXECTYPE VARCHAR(10) NOT NULL, MD5SUM VARCHAR(35), DESCRIPTION VARCHAR(255), COMMENTS VARCHAR(255), TAG VARCHAR(255), LIQUIBASE VARCHAR(20), CONTEXTS VARCHAR(255), LABELS VARCHAR(255), DEPLOYMENT_ID VARCHAR(10))] -> [Help 1]

So I seem to be block by liquibase 😒in any case due to this schema change.

Environment

Postgresql 9.6 (run from docker with command `docker run -it --rm -e POSTGRES_PASSWORD=test-password -e POSTGRES_USER=proxyuser -e POSTGRES_DB=postgres -p 5432:5432 postgres:9.6.10-alpine`
For the other part, it's used from maven:

1 2 3 4 5 Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T20:41:47+02:00) Maven home: /usr/local/Cellar/maven/3.6.0/libexec Java version: 1.8.0_192, vendor: Oracle Corporation, runtime: /Users/kevin/.jabba/jdk/adopt@1.8.192-12/Contents/Home/jre Default locale: fr_FR, platform encoding: UTF-8 OS name: "mac os x", version: "10.14.3", arch: "x86_64", family: "mac"

Status

Assignee

Unassigned

Reporter

Kevin Davin

Labels

None

Affects versions

3.6.2
3.6.3
3.6.1

Priority

Critical