Search in sources :

Example 1 with DbClean

use of org.flywaydb.core.internal.command.DbClean in project flyway by flyway.

the class Flyway method doValidate.

/**
     * Performs the actual validation. All set up must have taken place beforehand.
     *
     * @param connectionMetaDataTable The database connection for the metadata table.
     * @param dbSupport               The database-specific support.
     * @param migrationResolver       The migration resolver;
     * @param metaDataTable           The metadata table.
     * @param schemas                 The schemas managed by Flyway.
     * @param pending                 Whether pending migrations are ok.
     */
private void doValidate(Connection connectionMetaDataTable, DbSupport dbSupport, MigrationResolver migrationResolver, MetaDataTable metaDataTable, Schema[] schemas, FlywayCallback[] flywayCallbacks, boolean pending) {
    String validationError = new DbValidate(connectionMetaDataTable, dbSupport, metaDataTable, schemas[0], migrationResolver, target, outOfOrder, pending, ignoreMissingMigrations, ignoreFutureMigrations, flywayCallbacks).validate();
    if (validationError != null) {
        if (cleanOnValidationError) {
            new DbClean(connectionMetaDataTable, dbSupport, metaDataTable, schemas, flywayCallbacks, cleanDisabled).clean();
            metaDataTable.clearCache();
        } else {
            throw new FlywayException("Validate failed: " + validationError);
        }
    }
}
Also used : FlywayException(org.flywaydb.core.api.FlywayException) DbValidate(org.flywaydb.core.internal.command.DbValidate) DbClean(org.flywaydb.core.internal.command.DbClean)

Aggregations

FlywayException (org.flywaydb.core.api.FlywayException)1 DbClean (org.flywaydb.core.internal.command.DbClean)1 DbValidate (org.flywaydb.core.internal.command.DbValidate)1