Class CassandraDatabase

java.lang.Object
liquibase.database.AbstractJdbcDatabase
liquibase.ext.cassandra.database.CassandraDatabase
All Implemented Interfaces:
AutoCloseable, liquibase.database.Database, liquibase.servicelocator.PrioritizedService

public class CassandraDatabase extends liquibase.database.AbstractJdbcDatabase
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final liquibase.configuration.ConfigurationDefinition<Boolean>
    When running on AWS Keyspaces, a specific compatibility mode has to be activated for Liquibase because some behaviors need to be modified since AWS Keyspaces does not fully support CQL syntax.
    static final String
     
    static final Integer
     
    static final String
     
    static final String
     

    Fields inherited from class liquibase.database.AbstractJdbcDatabase

    caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercased

    Fields inherited from interface liquibase.database.Database

    COMPLETE_SQL_SCOPE_KEY, IGNORE_MISSING_REFERENCES_KEY

    Fields inherited from interface liquibase.servicelocator.PrioritizedService

    COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    escapeIndexName(String catalogName, String schemaName, String indexName)
    there shouldn't be keyspace name before the index name, queries fail otherwise
     
    int
     
    Cassandra actually doesn't support neither catalogs nor schemas, but keyspaces.
    protected String
     
     
     
     
    int
     
     
     
    boolean
     
    static boolean
     
    boolean
     
    boolean
    isCorrectDatabaseImplementation(liquibase.database.DatabaseConnection conn)
     
    boolean
     
     
    void
    setAutoCommit(boolean b)
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     

    Methods inherited from class liquibase.database.AbstractJdbcDatabase

    addReservedWords, canCreateChangeLogTable, close, commit, correctObjectName, correctSchema, correctSchema, createsIndexesForForeignKeys, dataTypeIsNotModifiable, disableForeignKeyChecks, doesTagExist, dropDatabaseObjects, enableForeignKeyChecks, equals, escapeColumnName, escapeColumnName, escapeColumnNameList, escapeConstraintName, escapeDataTypeName, escapeObjectName, escapeObjectName, escapeSequenceName, escapeStringForDatabase, escapeTableName, escapeViewName, execute, executeRollbackStatements, executeRollbackStatements, executeStatements, filterRollbackVisitors, generateAutoIncrementBy, generateAutoIncrementStartWith, generateDatabaseFunctionValue, generatePrimaryKeyName, get, getAutoCommitMode, getAutoIncrementByClause, getAutoIncrementClause, getAutoIncrementClause, getAutoIncrementClause, getAutoIncrementClosing, getAutoIncrementOpening, getAutoIncrementStartWithClause, getConcatSql, getConnection, getConnectionCatalogName, getConnectionSchemaName, getConnectionSchemaNameCallStatement, getContainingObjects, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseMajorVersion, getDatabaseProductName, getDatabaseProductVersion, getDataTypeMaxParameters, getDateFunctions, getDateLiteral, getDateLiteral, getDateLiteral, getDateTimeLiteral, getDefaultFractionalDigitsForTimestamp, getDefaultScaleForNativeDataType, getDefaultSchema, getDefaultSchemaName, getFetchSize, getJdbcCatalogName, getJdbcCatalogName, getJdbcSchemaName, getJdbcSchemaName, getLineComment, getLiquibaseCatalogName, getLiquibaseSchemaName, getLiquibaseTablespaceName, getMaxFractionalDigitsForTimestamp, getName, getObjectQuotingStrategy, getOutputDefaultCatalog, getOutputDefaultSchema, getQuotingEndCharacter, getQuotingEndReplacement, getQuotingStartCharacter, getRanChangeSet, getRanChangeSetList, getRanDate, getRawDatabaseChangeLogLockTableName, getRawDatabaseChangeLogTableName, getRunStatus, getSchemaAndCatalogCase, getSchemaFromJdbcInfo, getSystemSchema, getSystemTables, getSystemViews, getTimeLiteral, getViewDefinition, hashCode, isCatalogOrSchemaType, isCurrentTimeFunction, isDateOnly, isDateTime, isDefaultCatalog, isDefaultSchema, isFunction, isLiquibaseObject, isReservedWord, isSafeToRunUpdate, isSystemObject, isSystemView, isTimeOnly, isTimestamp, markChangeSetExecStatus, mustQuoteObjectName, parseDate, quoteObject, removeRanStatus, requiresExplicitNullForColumns, requiresPassword, requiresUsername, resetInternalState, rollback, saveRollbackStatement, saveStatements, set, setCanCacheLiquibaseTableInfo, setCaseSensitive, setConnection, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultCatalogName, setDefaultSchemaName, setLiquibaseCatalogName, setLiquibaseSchemaName, setLiquibaseTablespaceName, setObjectQuotingStrategy, setOutputDefaultCatalog, setOutputDefaultSchema, setPreviousAutoCommit, startsWithNumeric, supportsAutoIncrement, supportsBatchUpdates, supportsCatalogInObjectName, supportsCatalogs, supportsDDLInTransaction, supportsForeignKeyDisable, tag, toString, unescapeDataTypeName, unescapeDataTypeString, validate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface liquibase.database.Database

    addCompleteSqlToScope, afterUpdate, checkDatabaseConnection, dropDatabaseObjects, escapeForLike, failOnDefferable, generateConnectCommandSuccessMessage, getDisplayName, supports, supportsCreateIfNotExists, supportsDatabaseChangeLogHistory, temporarilySetObjectQuotingStrategy
  • Field Details

    • PRODUCT_NAME

      public static final String PRODUCT_NAME
      See Also:
    • SHORT_PRODUCT_NAME

      public static final String SHORT_PRODUCT_NAME
      See Also:
    • DEFAULT_PORT

      public static final Integer DEFAULT_PORT
    • DEFAULT_DRIVER

      public static final String DEFAULT_DRIVER
      See Also:
    • AWS_KEYSPACES_COMPATIBILITY_MODE

      public static final liquibase.configuration.ConfigurationDefinition<Boolean> AWS_KEYSPACES_COMPATIBILITY_MODE
      When running on AWS Keyspaces, a specific compatibility mode has to be activated for Liquibase because some behaviors need to be modified since AWS Keyspaces does not fully support CQL syntax. See: Issue #297 and: Support Cassandra APIs in AWS Keyspaces
  • Constructor Details

    • CassandraDatabase

      public CassandraDatabase()
  • Method Details

    • isAwsKeyspacesCompatibilityModeEnabled

      public static boolean isAwsKeyspacesCompatibilityModeEnabled()
    • getShortName

      public String getShortName()
    • getPriority

      public int getPriority()
    • getDefaultDatabaseProductName

      protected String getDefaultDatabaseProductName()
      Specified by:
      getDefaultDatabaseProductName in class liquibase.database.AbstractJdbcDatabase
    • getDefaultPort

      public Integer getDefaultPort()
    • getDatabaseMinorVersion

      public int getDatabaseMinorVersion() throws liquibase.exception.DatabaseException
      Specified by:
      getDatabaseMinorVersion in interface liquibase.database.Database
      Overrides:
      getDatabaseMinorVersion in class liquibase.database.AbstractJdbcDatabase
      Throws:
      liquibase.exception.DatabaseException
    • supportsInitiallyDeferrableColumns

      public boolean supportsInitiallyDeferrableColumns()
    • supportsSequences

      public boolean supportsSequences()
      Specified by:
      supportsSequences in interface liquibase.database.Database
      Overrides:
      supportsSequences in class liquibase.database.AbstractJdbcDatabase
    • isCorrectDatabaseImplementation

      public boolean isCorrectDatabaseImplementation(liquibase.database.DatabaseConnection conn) throws liquibase.exception.DatabaseException
      Throws:
      liquibase.exception.DatabaseException
    • getDefaultDriver

      public String getDefaultDriver(String url)
    • supportsTablespaces

      public boolean supportsTablespaces()
    • supportsRestrictForeignKeys

      public boolean supportsRestrictForeignKeys()
      Specified by:
      supportsRestrictForeignKeys in interface liquibase.database.Database
      Overrides:
      supportsRestrictForeignKeys in class liquibase.database.AbstractJdbcDatabase
    • supportsDropTableCascadeConstraints

      public boolean supportsDropTableCascadeConstraints()
      Specified by:
      supportsDropTableCascadeConstraints in interface liquibase.database.Database
      Overrides:
      supportsDropTableCascadeConstraints in class liquibase.database.AbstractJdbcDatabase
    • isAutoCommit

      public boolean isAutoCommit()
      Specified by:
      isAutoCommit in interface liquibase.database.Database
      Overrides:
      isAutoCommit in class liquibase.database.AbstractJdbcDatabase
    • setAutoCommit

      public void setAutoCommit(boolean b)
      Specified by:
      setAutoCommit in interface liquibase.database.Database
      Overrides:
      setAutoCommit in class liquibase.database.AbstractJdbcDatabase
    • isCaseSensitive

      public boolean isCaseSensitive()
      Specified by:
      isCaseSensitive in interface liquibase.database.Database
      Overrides:
      isCaseSensitive in class liquibase.database.AbstractJdbcDatabase
    • getCurrentDateTimeFunction

      public String getCurrentDateTimeFunction()
      Specified by:
      getCurrentDateTimeFunction in interface liquibase.database.Database
      Overrides:
      getCurrentDateTimeFunction in class liquibase.database.AbstractJdbcDatabase
    • getKeyspace

      public String getKeyspace()
    • supportsSchemas

      public boolean supportsSchemas()
      Specified by:
      supportsSchemas in interface liquibase.database.Database
      Overrides:
      supportsSchemas in class liquibase.database.AbstractJdbcDatabase
    • getDefaultCatalogName

      public String getDefaultCatalogName()
      Cassandra actually doesn't support neither catalogs nor schemas, but keyspaces. As default liquibase classes don't know what is keyspace we gonna use keyspace instead of catalog
      Specified by:
      getDefaultCatalogName in interface liquibase.database.Database
      Overrides:
      getDefaultCatalogName in class liquibase.database.AbstractJdbcDatabase
    • getStatement

      public Statement getStatement() throws liquibase.exception.DatabaseException
      Throws:
      liquibase.exception.DatabaseException
    • prepareStatement

      public PreparedStatement prepareStatement(String query) throws liquibase.exception.DatabaseException
      Throws:
      liquibase.exception.DatabaseException
    • jdbcCallsCatalogsSchemas

      public boolean jdbcCallsCatalogsSchemas()
      Overrides:
      jdbcCallsCatalogsSchemas in class liquibase.database.AbstractJdbcDatabase
    • supportsNotNullConstraintNames

      public boolean supportsNotNullConstraintNames()
      Specified by:
      supportsNotNullConstraintNames in interface liquibase.database.Database
      Overrides:
      supportsNotNullConstraintNames in class liquibase.database.AbstractJdbcDatabase
    • supportsPrimaryKeyNames

      public boolean supportsPrimaryKeyNames()
      Specified by:
      supportsPrimaryKeyNames in interface liquibase.database.Database
      Overrides:
      supportsPrimaryKeyNames in class liquibase.database.AbstractJdbcDatabase
    • escapeIndexName

      public String escapeIndexName(String catalogName, String schemaName, String indexName)
      there shouldn't be keyspace name before the index name, queries fail otherwise
      Specified by:
      escapeIndexName in interface liquibase.database.Database
      Overrides:
      escapeIndexName in class liquibase.database.AbstractJdbcDatabase