Eric Mamet
Eric Mamet

Reputation: 3641

Why is liquibase trying to recreate the table DATABASECHANGELOG

I created a liquibase.properties as follows

driver: net.snowflake.client.jdbc.SnowflakeDriver
classpath: ./liquibase-snowflake-1.0.jar
url: jdbc:snowflake://....us-east-1.snowflakecomputing.com/?db=...&warehouse=...&schema=LIQUIBASE&role=SYSADMIN
username: ...
password: ...
changeLogFile: mySnowflakeChangeLog.xml

Initially running liquibase while the file mySnowflakeChangeLog.xml did not exist worked up to creating the liquibase tables within the LIQUIBASE schema (which I had to create first).

Now, if I supply a simple changelog file mySnowflakeChangeLog.xml (see below), the update fails when trying to re-create the underlying liquibase table: "Object 'DATABASECHANGELOG' already exists"

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet author="eric" id="changelog-1.0">
        <createTable tableName="TablesAndTables">
        <column name="COLUMN1" type="TEXT">
            <constraints nullable="true" primaryKey="false" unique="false"/>
        </column>
        </createTable>
    </changeSet>
</databaseChangeLog>

Am I missing something? (I suppose I am...)

Upvotes: 2

Views: 1613

Answers (1)

Eric Mamet
Eric Mamet

Reputation: 3641

I had specified a default schema of LIQUIBASE but I had not informed liquibase where to retrieve its tables.

This is done through the parameter liquibaseSchemaName so all I had to do was to add the following line in my liquibase.properties file

liquibaseSchemaName: LIQUIBASE

Upvotes: 1

Related Questions