All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.ext.databricks.snapshot.jvm.IndexSnapshotGeneratorDatabricks Maven / Gradle / Ivy

package liquibase.ext.databricks.snapshot.jvm;


import liquibase.database.Database;
import liquibase.exception.DatabaseException;
import liquibase.ext.databricks.database.DatabricksDatabase;
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.snapshot.InvalidExampleException;
import liquibase.snapshot.SnapshotGenerator;
import liquibase.snapshot.SnapshotGeneratorChain;
import liquibase.snapshot.jvm.IndexSnapshotGenerator;
import liquibase.structure.DatabaseObject;

/**
 * Databricks does not really support indexes on tables
 * (required customer CLUSTER BY / ZORDER change types to be implemented outside of indexes since they are a part of a Create table / ALTER table DDL/DML
 */
public class IndexSnapshotGeneratorDatabricks extends IndexSnapshotGenerator {

    @Override
    public int getPriority(Class objectType, Database database) {
        if (database instanceof DatabricksDatabase) {
            return super.getPriority(objectType, database) + PRIORITY_DATABASE;
        } else {
            return PRIORITY_NONE;
        }
    }

    @Override
    public Class[] replaces() {
        return new Class[] {IndexSnapshotGenerator.class};
    }

    @Override
    public DatabaseObject snapshot(DatabaseObject example, DatabaseSnapshot snapshot, SnapshotGeneratorChain chain) throws DatabaseException, InvalidExampleException {
        return chain.snapshot(example, snapshot);
    }

    @Override
    protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException {
        return null;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy