use of liquibase.database.core.UnsupportedDatabase in project collect by openforis.
the class LiquidbaseDatabaseSnapshotBuilder method createSnapshot.
public synchronized DatabaseSnapshot createSnapshot(RelationalSchema relationalSchema, boolean dbSupportsFKs) throws DatabaseException {
this.schema = relationalSchema;
UnsupportedDatabase db = new UnsupportedDatabase();
snapshot = new DatabaseSnapshot(db, null);
createTables();
createPKIndexes();
if (dbSupportsFKs) {
createForeignKeys();
}
return snapshot;
}
use of liquibase.database.core.UnsupportedDatabase in project liquibase by liquibase.
the class DatabaseFactory method findCorrectDatabaseImplementation.
public Database findCorrectDatabaseImplementation(DatabaseConnection connection) throws DatabaseException {
SortedSet<Database> foundDatabases = new TreeSet<>(new DatabaseComparator());
for (Database implementedDatabase : getImplementedDatabases()) {
if (connection instanceof OfflineConnection) {
if (((OfflineConnection) connection).isCorrectDatabaseImplementation(implementedDatabase)) {
foundDatabases.add(implementedDatabase);
}
} else {
if (implementedDatabase.isCorrectDatabaseImplementation(connection)) {
foundDatabases.add(implementedDatabase);
}
}
}
if (foundDatabases.isEmpty()) {
LOG.warning("Unknown database: " + connection.getDatabaseProductName());
UnsupportedDatabase unsupportedDB = new UnsupportedDatabase();
unsupportedDB.setConnection(connection);
return unsupportedDB;
}
Database returnDatabase;
try {
returnDatabase = foundDatabases.iterator().next().getClass().getConstructor().newInstance();
} catch (Exception e) {
throw new UnexpectedLiquibaseException(e);
}
returnDatabase.setConnection(connection);
return returnDatabase;
}
Aggregations