Merge pull request 'fixes bug#AL-2004' (#11) from AL-2004 into master

Reviewed-on: http://18.235.188.113:3000/utilidades/Flyway/pulls/11
Reviewed-by: Gleison da Cruz <gleison.cruz@totvs.com.br>
Reviewed-by: pinheiro <valdevir@rjconsultores.com.br>
master
fabio 2023-01-05 12:59:14 +00:00
commit 2cbcfa78fd
5 changed files with 54 additions and 1 deletions

View File

@ -4,7 +4,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId>
<artifactId>Flyway</artifactId>
<version>1.0.12</version>
<version>1.0.13</version>
<distributionManagement>
<repository>

View File

@ -42,6 +42,7 @@ public class FlyWay {
private String password = null;
private String location = "db.migration";
private String oldies = "db.backup.oracle";
private FlyWay() {
@ -163,6 +164,8 @@ public class FlyWay {
flyway.setLocations(customLocation);
} else if (this.location != null && !this.location.equals("db.migration")) {
flyway.setLocations(this.location);
}else {
flyway.setLocations(this.oldies, this.location);
}
if (dataSource != null) {

View File

@ -0,0 +1,15 @@
declare
object_exists exception;
except_01451 exception;
except_01442 exception;
pragma exception_init (object_exists , -01430);
pragma exception_init (except_01451 , -01451);
pragma exception_init (except_01442 , -01442);
begin
execute immediate 'ALTER TABLE FECHAMENTO_BOLETO ADD TIPO_PAGAMENTO VARCHAR2(1)';
exception
when object_exists then null;
when except_01451 then null;
when except_01442 then null;
end;

View File

@ -0,0 +1,34 @@
-- INSERT / UPDATE
declare
dup_val_on_index exception;
except_02291 exception;
pragma exception_init (dup_val_on_index , -00001);
pragma exception_init (except_02291 , -02291);
begin
execute immediate 'update fechamento_boleto set tipo_pagamento = ''D''
where fechamentoboleto_id in (
SELECT fb.fechamentoboleto_id
FROM fechamento_deposito fd
INNER JOIN fechamento_boleto fb
on fd.fechamentocntcorrente_id = fb.fechamentocntcorrente_id
and fb.activo = 1
where fd.activo = 1
)';
exception
when dup_val_on_index then null;
when except_02291 then null;
end;
/
declare
dup_val_on_index exception;
except_02291 exception;
pragma exception_init (dup_val_on_index , -00001);
pragma exception_init (except_02291 , -02291);
begin
execute immediate 'update fechamento_boleto set tipo_pagamento = ''B'' where tipo_pagamento is null and activo = 1';
exception
when dup_val_on_index then null;
when except_02291 then null;
end;