Uploaded image for project: 'Liquibase Core'
  1. CORE-3390

Error when using dropAll and update twice in different schema

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects versions: 3.6.1, 3.6.2, 3.6.3
    • Fix versions: None
    • Environment:
    • Sprint:

      Description

      Hi,

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

      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:

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

      My maven parameters are the following:

      <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.

      [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.

        Attachments

          Activity

            People

            • Reporter:
              davin.kevin Kevin Davin
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: