From 1d3ffd049db4751aafb10f98a1d67bb00760bbd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aristides=20dos=20Reis=20J=C3=BAnior?= Date: Wed, 12 Jun 2024 10:41:15 -0300 Subject: [PATCH] fixes bug#AL_4075 --- pom.xml | 2 +- src/db/migration/V20240607_1754__AL-4075.sql | 64 ++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/db/migration/V20240607_1754__AL-4075.sql diff --git a/pom.xml b/pom.xml index 4c82103de..0f930a227 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 br.com.rjconsultores Flyway - 1.45.3 + 1.46.0 diff --git a/src/db/migration/V20240607_1754__AL-4075.sql b/src/db/migration/V20240607_1754__AL-4075.sql new file mode 100644 index 000000000..35c073110 --- /dev/null +++ b/src/db/migration/V20240607_1754__AL-4075.sql @@ -0,0 +1,64 @@ +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 usuario_ubicacion SET activo=0, usuariomodif_id=1, fecmodif=sysdate WHERE ROWID IN ( SELECT rid FROM ( SELECT ROWID rid, ROW_NUMBER() OVER(PARTITION BY usuario_id, activo ORDER BY ROWID ) rn FROM usuario_ubicacion where activo=1 ) WHERE rn <> 1 )'; + exception + when dup_val_on_index then null; + when except_02291 then null; +end; +/ + +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 usuario_ubicacion ADD PADRAO NUMBER(1,0)'; + exception + when object_exists then null; + when except_01451 then null; + when except_01442 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 usuario_ubicacion set padrao=1 WHERE 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 'insert into constante (constante_id,nombconstante,descconstante,valorconstante,indmantenimientousuario,activo,fecmodif,usuario_id) + values (constante_seq.nextval,''IND_MULTI_PUNTOVENTA_CRIADO'',''INDICA SE O CODIGO O CODIGO, JÁ POSSUI O MULTI PTV'',''true'',0,1,sysdate,1)'; + exception + when dup_val_on_index then null; + when except_02291 then null; +end; +/ + + + +