/** * Executes the given changelog file. This file is assumed to be on the classpath. If no file is * given, the default {@link #CHANGE_LOG_FILE} is ran. * * @param changelog The string filename of a liquibase changelog xml file to run * @param userInput nullable map from question to user answer. Used if a call to * executeChangelog(<String>, null) threw an {@link InputRequiredException} * @return A list of messages or warnings generated by the executed changesets * @throws InputRequiredException if the changelog file requires some sort of user input. The * error object will list of the user prompts and type of data for each prompt */ public static List<String> executeChangelog(String changelog, Map<String, Object> userInput, ChangeSetExecutorCallback callback) throws DatabaseUpdateException, InputRequiredException { log.debug("installing the tables into the database"); if (changelog == null) { changelog = CHANGE_LOG_FILE; } try { return executeChangelog(changelog, CONTEXT, userInput, callback, null); } catch (Exception e) { throw new DatabaseUpdateException("There was an error while updating the database to the latest. file: " + changelog + ". Error: " + e.getMessage(), e); } }
Map<String, Object[]> databaseUpdateErrors = new HashMap<>(); databaseUpdateErrors.put(ErrorMessageConstants.UPDATE_ERROR_UNABLE, null); for (String errorMessage : Arrays.asList(e.getMessage().split("\n"))) { databaseUpdateErrors.put(errorMessage, null);
reportError(ErrorMessageConstants.ERROR_DB_UPDATE, DEFAULT_PAGE, updateEx.getMessage()); return;
throw new DatabaseUpdateException("Unable to check if database updates are required", e); DatabaseUpdater.executeChangelog(); } else { throw new DatabaseUpdateException( "Database updates are required. Call Context.updateDatabase() before .startup() to continue.");