Search in sources :

Example 1 with FlywayValidateException

use of org.flywaydb.core.api.exception.FlywayValidateException in project sparrow by sparrowwallet.

the class DbPersistence method migrate.

private void migrate(Storage storage, String schema, ECKey encryptionKey) throws StorageException {
    File migrationDir = getMigrationDir();
    try {
        Flyway flyway = getFlyway(storage, schema, getFilePassword(encryptionKey), migrationDir);
        flyway.migrate();
    } catch (FlywayValidateException e) {
        log.error("Failed to open wallet file. Validation error during schema migration.", e);
        throw new StorageException("Failed to open wallet file. Validation error during schema migration.", e);
    } catch (FlywayException e) {
        log.error("Failed to open wallet file. ", e);
        throw new StorageException("Failed to open wallet file.\n" + e.getMessage(), e);
    } finally {
        IOUtils.deleteDirectory(migrationDir);
    }
}
Also used : FlywayValidateException(org.flywaydb.core.api.exception.FlywayValidateException) Flyway(org.flywaydb.core.Flyway) FlywayException(org.flywaydb.core.api.FlywayException)

Aggregations

Flyway (org.flywaydb.core.Flyway)1 FlywayException (org.flywaydb.core.api.FlywayException)1 FlywayValidateException (org.flywaydb.core.api.exception.FlywayValidateException)1