Unable to create DATABASECHANGELOG in Cassandra

I’m trying to setup Liquibase with Cassandra and while I appear to be able to connect, the problem begins when Liquibase tries to create a DATABASECHANGELOG table into the database.

I have been referencing the following information:

The version of Liquibase being used is 4.27.0.
The version of Cassandra being used is 3.11.9.

I downloaded the following wrapper and extension files from their recommended sources:

  • cassandra-jdbc-wrapper-4.12.0-bundle.jar
  • liquibase-cassandra-4.27.0.jar

My liquibase.properties file:

classpath=liquibase_libs/cassandra-jdbc-wrapper-4.12.0-bundle.jar
driver=com.ing.data.cassandra.jdbc.CassandraDriver
changeLogFile=changelog/changelog-root.yaml

When I run the following from the root directory of my Liquibase project folder:

liquibase status --username=<username> --password=<password> --url=jdbc:cassandra://localhost:9042/<database_name>?localdatacenter=datacenter1&compliancemode=Liquibase

I get the following output:

##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ## 
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ## 
##                                                ##
####################################################
Starting Liquibase at 17:49:55 (version 4.27.0 #1525 built at 2024-03-25 17:08+0000)
Liquibase Version: 4.27.0
Liquibase Open Source 4.27.0 by Liquibase
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
ERROR: Exception Details
ERROR: Exception Primary Class:  SyntaxError
ERROR: Exception Primary Reason:  line 1:42 no viable alternative at input '(' (CREATE TABLE DATABASECHANGELOG (ID [VARCHAR](...)
ERROR: Exception Primary Source:  Cassandra 3.11.9

Unexpected error running Liquibase: line 1:42 no viable alternative at input '(' (CREATE TABLE DATABASECHANGELOG (ID [VARCHAR](...) [Failed SQL: (0) CREATE TABLE DATABASECHANGELOG (ID VARCHAR(255) NOT NULL, AUTHOR VARCHAR(255) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED datetime NOT NULL, ORDEREXECUTED INT 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))]

For more information, please use the --log-level flag

Would anyone be able to provide more assistance to why this is happening? Thanks

Another odd “bug” I noticed is that the order seems to matter for the options with compliancemode and localdatacenter.

When I order it as follows:
compliancemode=Liquibase&localdatacenter=datacenter1

like in the example link liquibase-cassandra/liquibase.properties at main · liquibase/liquibase-cassandra · GitHub, I get a different error:

##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ## 
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ## 
##                                                ##
####################################################
Starting Liquibase at 10:07:11 (version 4.27.0 #1525 built at 2024-03-25 17:08+0000)
Liquibase Version: 4.27.0
Liquibase Open Source 4.27.0 by Liquibase
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
ERROR: Exception Details
ERROR: Exception Primary Class:  IllegalStateException
ERROR: Exception Primary Reason:  Since you provided explicit contact points, the local DC must be explicitly set (see basic.load-balancing-policy.local-datacenter in the config, or set it programmatically with SessionBuilder.withLocalDatacenter). Current contact points are: Node(endPoint=127.0.0.1/<unresolved>:9042, hostId=<...>, hashCode=<...>)=datacenter1. Current DCs in this cluster are: datacenter1
ERROR: Exception Primary Source:  4.27.0

Unexpected error running Liquibase: Connection could not be created to jdbc:cassandra://127.0.0.1:9042/<db_name>?compliancemode=Liquibase with driver com.ing.data.cassandra.jdbc.CassandraDriver.  Unexpected error while creating connection.
  - Caused by: Since you provided explicit contact points, the local DC must be explicitly set (see basic.load-balancing-policy.local-datacenter in the config, or set it programmatically with SessionBuilder.withLocalDatacenter). Current contact points are: Node(endPoint=127.0.0.1/<unresolved>:9042, hostId=<...>, hashCode=<...>)=datacenter1. Current DCs in this cluster are: datacenter1

For some reason, Liquibase considers the DB as <unresolved>.

I believe the problem is the even when I set compliancemode=Liquibase, LIquibase still acts as if it where in normal SQL mode.

One tall tell sign it that it’s trying to create a DATABASECHANGELOG table with ID VARCHAR(255) and there is no VARCHAR type in Cassandra. The type should be TEXT instead.

Still, I don’t know what more needs to be set to make Liquibase be in Cassandra mode.

I tried using an older version of Liquibase (4.24.0) via container and it works:

liquibase@nixos:/liquibase/changeset$ liquibase status
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ## 
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ## 
##                                                ##
####################################################
Starting Liquibase at 17:41:35 (version 4.24.0 #14062 built at 2023-09-28 12:18+0000)
Liquibase Version: 4.24.0
Liquibase Open Source 4.24.0 by Liquibase
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
@jdbc:cassandra://localhost:9042/<database_name> is up to date
Liquibase command 'status' was executed successfully.

I think there is a bug with Liquibase version 2.27.0.