/** * Removes all executed scripts that indicate repeatable scripts that were removed since the last * database update * * @param repeatableScriptDeletions The scripts that were removed since the last database updates */ protected void removeDeletedRepeatableScriptsFromExecutedScripts( SortedSet<ScriptUpdate> repeatableScriptDeletions) { for (ScriptUpdate deletedRepeatableScriptUpdate : repeatableScriptDeletions) { executedScriptInfoSource.deleteExecutedScript( getAlreadyExecutedScripts().get(deletedRepeatableScriptUpdate.getScript())); } }
/** * Updates the records in the DBMAINTAIN_SCRIPTS table for all scripts that were regularly renamed * (i.e. renamed without changing the order of the incremental scripts. * * @param regularScriptRenames the scripts that were regularly renamed */ protected void performRegularScriptRenamesInExecutedScripts( SortedSet<ScriptUpdate> regularScriptRenames) { for (ScriptUpdate regularScriptRename : regularScriptRenames) { executedScriptInfoSource.renameExecutedScript( getAlreadyExecutedScripts().get(regularScriptRename.getScript()), regularScriptRename.getRenamedToScript()); } }
/** * Executes the given scripts and updates the database execution registry appropriately. After * each successful script execution, the script execution is registered in the database and marked * as successful. If a script execution fails, the script execution is registered in the database * and marked as unsuccessful. * * @param scriptUpdates the script updates to be executed */ protected void executeScriptUpdates(SortedSet<ScriptUpdate> scriptUpdates) { scriptRunner.initialize(); try { for (ScriptUpdate scriptUpdate : scriptUpdates) { long startTimeMs = currentTimeMillis(); executeScript(scriptUpdate.getScript()); long durationMs = currentTimeMillis() - startTimeMs; logger.info( "Executed " + scriptUpdatesFormatter.formatScriptUpdate(scriptUpdate) + " (" + durationMs + " ms)"); } } finally { scriptRunner.close(); } }