diff --git a/pom.xml b/pom.xml index 20b19467f..5002bba8b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 br.com.rjconsultores Flyway - 1.0.2 + 1.0.3 diff --git a/src/com/rjconsultores/ventaboletos/FlyWay.java b/src/com/rjconsultores/ventaboletos/FlyWay.java index 521d22597..fbc7f7cb6 100644 --- a/src/com/rjconsultores/ventaboletos/FlyWay.java +++ b/src/com/rjconsultores/ventaboletos/FlyWay.java @@ -146,7 +146,13 @@ public class FlyWay { public boolean start(final String customLocation, final String customTable, Boolean isReloadFlyway) { log.info("Executando Flyway..."); - try{ + try{ + String ambiente = System.getProperty("ambiente") ==null || System.getProperty("ambiente").isEmpty() ? "" : System.getProperty("ambiente"); + if( AMBIENTE_DEV.equalsIgnoreCase(ambiente) || AMBIENTE_CONSULTA.equalsIgnoreCase(ambiente) ) { + log.warn("Flyway não executado. Ambiente = dev ou consulta"); + return true; + } + final Flyway flyway = new Flyway(); if (customTable != null) { @@ -166,22 +172,16 @@ public class FlyWay { dataSource = flyway.getDataSource(); } - String ambiente = System.getProperty("ambiente") ==null || System.getProperty("ambiente").isEmpty() ? "" : System.getProperty("ambiente"); - if(!AMBIENTE_DEV.equals(ambiente.toLowerCase()) || !AMBIENTE_CONSULTA.equals(ambiente.toLowerCase()) || Boolean.TRUE.equals(isReloadFlyway)) { - execute(flyway); + + if(Boolean.TRUE.equals(isReloadFlyway)) { + execute(flyway); log.info("Flyway executado."); - }else { - log.warn("Flyway não executado. Ambiente = dev"); } - - }catch(Throwable t){ - log.error("Erro ao executar o Flyway",t); - + log.error("Erro ao executar o Flyway",t); return false; } - return true; }