From f589596cfc9dfc3e7abac75d7b39185dadd1d41e Mon Sep 17 00:00:00 2001 From: valdevir Date: Tue, 23 Aug 2022 13:53:19 +0000 Subject: [PATCH] fixes bug#00000 qua: dev:Valdevir Autorizar executar flyway apenas pelo ReloadFlyway qaundo argumeto "ambiente=dev" existir. git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@113936 d1611594-4594-4d17-8e1d-87c2c4800839 --- src/com/rjconsultores/ventaboletos/FlyWay.java | 12 ++++++++---- .../ventaboletos/servlet/ReloadFlyway.java | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/FlyWay.java b/src/com/rjconsultores/ventaboletos/FlyWay.java index 68b6a8abd..2d8213527 100644 --- a/src/com/rjconsultores/ventaboletos/FlyWay.java +++ b/src/com/rjconsultores/ventaboletos/FlyWay.java @@ -114,7 +114,11 @@ public class FlyWay { } public boolean start() { - return start(null, null); + return start(null, null, false); + } + + public boolean start(Boolean isReloadFyway) { + return start(null, null, isReloadFyway); } public boolean startCustom() { @@ -134,10 +138,10 @@ public class FlyWay { location = "filesystem:" + data.getPath(); } - return start(location, TABELA_FLYWAY); + return start(location, TABELA_FLYWAY, false); } - public boolean start(final String customLocation, final String customTable) { + public boolean start(final String customLocation, final String customTable, Boolean isReloadFlyway) { log.info("Executando Flyway..."); try{ @@ -161,7 +165,7 @@ public class FlyWay { dataSource = flyway.getDataSource(); } String ambiente = System.getProperty("ambiente"); - if(!AMBIENTE_DEV.equals(ambiente)) { + if(!AMBIENTE_DEV.equals(ambiente) || Boolean.TRUE.equals(isReloadFlyway)) { execute(flyway); log.info("Flyway executado."); }else { diff --git a/src/com/rjconsultores/ventaboletos/servlet/ReloadFlyway.java b/src/com/rjconsultores/ventaboletos/servlet/ReloadFlyway.java index 25c94ece7..ea5064a96 100644 --- a/src/com/rjconsultores/ventaboletos/servlet/ReloadFlyway.java +++ b/src/com/rjconsultores/ventaboletos/servlet/ReloadFlyway.java @@ -20,7 +20,7 @@ public class ReloadFlyway extends HttpServlet { out = resp.getWriter(); out.println("

Reload Flyway

"); - boolean retorno = FlyWay.getInstance().start(); + boolean retorno = FlyWay.getInstance().start(true); if (retorno) { out.print("Processo realizado com sucesso.");