liquibase.snapshot.jvm.UniqueConstraintSnapshotGeneratorSnowflake Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
package liquibase.snapshot.jvm;
import liquibase.Scope;
import liquibase.database.Database;
import liquibase.database.core.SnowflakeDatabase;
import liquibase.exception.DatabaseException;
import liquibase.executor.ExecutorService;
import liquibase.snapshot.CachedRow;
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.snapshot.SnapshotGenerator;
import liquibase.statement.core.RawSqlStatement;
import liquibase.structure.DatabaseObject;
import liquibase.structure.core.*;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
public class UniqueConstraintSnapshotGeneratorSnowflake extends UniqueConstraintSnapshotGenerator {
@Override
public int getPriority(Class extends DatabaseObject> objectType, Database database) {
if (database instanceof SnowflakeDatabase) {
return PRIORITY_DATABASE;
} else {
return PRIORITY_NONE;
}
}
@Override
public Class extends SnapshotGenerator>[] replaces() {
return new Class[] { UniqueConstraintSnapshotGenerator.class };
}
@Override
protected List listConstraints(Table table, DatabaseSnapshot snapshot, Schema schema)
throws DatabaseException, SQLException {
return new SnowflakeResultSetConstraintsExtractor(snapshot, schema.getCatalogName(), schema.getName(), table.getName())
.fastFetch();
}
@Override
protected List