Search in sources :

Example 1 with DbUpgradeValidationResult

use of org.mifos.db.upgrade.DbUpgradeValidationResult in project head by mifos.

the class DatabaseInitFilter method init.

@Override
public synchronized void init(FilterConfig filterConfig) {
    try {
        DatabaseUpgradeSupport databaseUpgradeSupport = ServletUtils.getBean(filterConfig.getServletContext(), BEAN_NAME);
        DbUpgradeValidationResult validationResult = databaseUpgradeSupport.validate();
        databaseVerified = validationResult.allUpgradesApplied();
        if (!databaseVerified) {
            ApplicationInitializer.setDatabaseError(DatabaseErrorCode.UPGRADE_FAILURE, "There are un applied db upgrades: ", new RuntimeException(validationResult.getUnAppliedChangeSets()));
        }
    } catch (Exception e) {
        filterConfig.getServletContext().log("Failed to check for unapplied upgrades upgrades", e);
    }
}
Also used : DbUpgradeValidationResult(org.mifos.db.upgrade.DbUpgradeValidationResult) DatabaseUpgradeSupport(org.mifos.db.upgrade.DatabaseUpgradeSupport) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 ServletException (javax.servlet.ServletException)1 DatabaseUpgradeSupport (org.mifos.db.upgrade.DatabaseUpgradeSupport)1 DbUpgradeValidationResult (org.mifos.db.upgrade.DbUpgradeValidationResult)1