Reputation: 41
I am trying to wire up liquibase to be used with Snowflake. I got it to build and start up. It creates the DatabaseChangeLog and DatabaseChangeLogLock tables. But when trying to insert data into the DatabaseChangeLog table I get the following error:
WARNING 10/4/18 5:13 PM: liquibase: Unknown database: Snowflake
Unexpected error running Liquibase: SQL compilation error:
Expression type does not match column data type, expecting TIMESTAMP_NTZ(9) but got TIMESTAMP_LTZ(9) for column DATEEXECUTED
I found the code to convert DATETIME to TIMESTAMP_NTZ, but this is moot as Snowflake has now added the DATETIME data type. How am I supposed to get the metadata to load into this table if Liquibase is trying to load it into a different data type?
I am open to all suggestions, but I am not a java programmer, so it will not be an easy go if I have to create java programs to correct this issue.
Upvotes: 4
Views: 976
Reputation: 310
Until there is a fix on Snowflake/liquibase side for this, I worked around this issue by introducing a change set that should be the first one executed by liquibase:
<?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.8.xsd">
<changeSet id="1" author="user">
<comment>Fix liquibase type mismatch</comment>
<sql>
<!--Due to snowflake and liquibase datetime type mismatch-->
ALTER TABLE "DATABASECHANGELOG" DROP COLUMN "DATEEXECUTED";
ALTER TABLE "DATABASECHANGELOG" ADD COLUMN "DATEEXECUTED" TIMESTAMP_LTZ;
</sql>
<rollback>
</rollback>
</changeSet>
</databaseChangeLog>
Upvotes: 0
Reputation: 9016
Unfortunately, someone with Java development experience will need to make changes to either Liquibase or in a Liquibase extension to support the snowflake DBMS.
Upvotes: 1