Melhorias para o EAP

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@74271 d1611594-4594-4d17-8e1d-87c2c4800839
master
alberto 2017-09-26 22:34:40 +00:00
parent 8cf8e2d3fa
commit 10171461c4
1 changed files with 33 additions and 6 deletions

View File

@ -73,12 +73,9 @@ public class FlyWay {
final Flyway flyway = new Flyway(); final Flyway flyway = new Flyway();
flyway.setDataSource(dataSource); flyway.setDataSource(dataSource);
flyway.setValidateOnMigrate(false);
flyway.setIgnoreFutureMigrations(true); execute(flyway);
flyway.setOutOfOrder(true);
flyway.setBaselineOnMigrate(true);
flyway.migrate();
}catch(Throwable t){ }catch(Throwable t){
log.error("Erro ao executar o flyway",t); log.error("Erro ao executar o flyway",t);
@ -89,4 +86,34 @@ public class FlyWay {
return true; return true;
} }
public boolean start(String url, String user, String password) {
log.info("Executando Flyway...");
try{
final Flyway flyway = new Flyway();
flyway.setDataSource(url, user, password);
execute(flyway);
}catch(Throwable t){
log.error("Erro ao executar o flyway",t);
return false;
}
log.info("Flyway executado.");
return true;
}
public void execute(final Flyway flyway) {
flyway.setValidateOnMigrate(false);
flyway.setIgnoreFutureMigrations(true);
flyway.setOutOfOrder(true);
flyway.setBaselineOnMigrate(true);
flyway.migrate();
}
} }