From ce62089f41a9402e2105d7cbd56fa98cc2e3e7d2 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Thu, 22 Dec 2022 18:18:18 -0300 Subject: [PATCH 1/2] bug#AL-1786 --- pom.xml | 2 +- src/db/migration/V20221128_1234__AL1183.sql | 28 +++++++++++++++++ src/db/migration/V20221128_1235__AL1786.sql | 30 +++++++++++++++++++ src/db/migration/V20221207_1034__AL-1860.sql | 13 ++++++++ src/db/migration/V20221221_1650__AL-1786.sql | 28 +++++++++++++++++ .../migration/V20221128_1234__AL1183.sql | 28 +++++++++++++++++ .../migration/V20221128_1235__AL1786.sql | 30 +++++++++++++++++++ .../migration/V20221207_1034__AL-1860.sql | 13 ++++++++ .../migration/V20221221_1650__AL-1786.sql | 28 +++++++++++++++++ 9 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 src/db/migration/V20221128_1234__AL1183.sql create mode 100644 src/db/migration/V20221128_1235__AL1786.sql create mode 100644 src/db/migration/V20221207_1034__AL-1860.sql create mode 100644 src/db/migration/V20221221_1650__AL-1786.sql create mode 100644 src/db/postgresql/migration/V20221128_1234__AL1183.sql create mode 100644 src/db/postgresql/migration/V20221128_1235__AL1786.sql create mode 100644 src/db/postgresql/migration/V20221207_1034__AL-1860.sql create mode 100644 src/db/postgresql/migration/V20221221_1650__AL-1786.sql diff --git a/pom.xml b/pom.xml index 4eabce60a..343e79f12 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 br.com.rjconsultores Flyway - 1.0.6 + 1.0.7 diff --git a/src/db/migration/V20221128_1234__AL1183.sql b/src/db/migration/V20221128_1234__AL1183.sql new file mode 100644 index 000000000..49379b847 --- /dev/null +++ b/src/db/migration/V20221128_1234__AL1183.sql @@ -0,0 +1,28 @@ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate + 'CREATE TABLE EMPRESA_EREDE_CONFIG + ( + EMPRESAEREDE_ID NUMBER(7, 0) NOT NULL + , EMPRESA_ID NUMBER(7, 0) + , FILIATION VARCHAR2(50 BYTE) + , TOKEN VARCHAR2(100 BYTE) + , INDPRODUCAO NUMBER(1,0) + , ACTIVO NUMBER(1,0) + , FECMODIF DATE + , USUARIO_ID NUMBER(7,0) + , CONSTRAINT EMPRESA_EREDE_CONFIG PRIMARY KEY ( EMPRESAEREDE_ID ) ENABLE ) '; + + exception when object_exists then null; +end; +/ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate + 'CREATE SEQUENCE EMP_EREDE_CONFIG_SEQ'; + exception when object_exists then null; +end; diff --git a/src/db/migration/V20221128_1235__AL1786.sql b/src/db/migration/V20221128_1235__AL1786.sql new file mode 100644 index 000000000..39421f455 --- /dev/null +++ b/src/db/migration/V20221128_1235__AL1786.sql @@ -0,0 +1,30 @@ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate + 'CREATE TABLE EMPRESA_CIELOLINK_CONFIG + ( + EMPRESACIELOLINK_ID NUMBER(7, 0) NOT NULL + , EMPRESA_ID NUMBER(7, 0) + , CLIENT_ID VARCHAR2(50 BYTE) + , MERCHANT_ID VARCHAR2(50 BYTE) + , SECRET VARCHAR2(50 BYTE) + , MINUTOS_CANCELA NUMBER(7,0) + , URL VARCHAR2(50 BYTE) + , ACTIVO NUMBER(1,0) + , FECMODIF DATE + , USUARIO_ID NUMBER(7,0) + , CONSTRAINT EMPRESA_CIELOLINK_CONFIG PRIMARY KEY ( EMPRESACIELOLINK_ID ) ENABLE ) '; + + exception when object_exists then null; +end; +/ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate + 'CREATE SEQUENCE EMP_CIELOLINK_CONFIG_SEQ'; + exception when object_exists then null; +end; diff --git a/src/db/migration/V20221207_1034__AL-1860.sql b/src/db/migration/V20221207_1034__AL-1860.sql new file mode 100644 index 000000000..83ef67012 --- /dev/null +++ b/src/db/migration/V20221207_1034__AL-1860.sql @@ -0,0 +1,13 @@ +-- 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 'Insert into AUTORIZACION (AUTORIZACION_ID,NOMBAUTORIZACION,DESCAUTORIZACION,ACTIVO,FECMODIF,USUARIO_ID) values (AUTORIZACION_SEQ.NEXTVAL,''AUT_MAPA_LGPD'',''AUTORIZACAO PARA EXIBIR DADOS LGPD NO MAPA DE VIAGEM'',1,SYSDATE,1)'; + exception + when dup_val_on_index then null; + when except_02291 then null; +end; \ No newline at end of file diff --git a/src/db/migration/V20221221_1650__AL-1786.sql b/src/db/migration/V20221221_1650__AL-1786.sql new file mode 100644 index 000000000..98ef59e1f --- /dev/null +++ b/src/db/migration/V20221221_1650__AL-1786.sql @@ -0,0 +1,28 @@ +-- 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 'Insert into empresa_cielolink_config + (empresacielolink_id, empresa_id, merchant_id, minutos_cancela, client_id, url, secret, usuario_id, fecmodif, activo) + select + EMP_CIELOLINK_CONFIG_SEQ.nextval, empresa_id, merchant_id , minutos , client_id , url , secret , usuario_id , fecmodif, activo from + ( + select + empresa_id, + (SELECT valorconstante FROM constante where nombconstante like ''MERCHANT_ID_CIELO_LINK'') as merchant_id, + (SELECT valorconstante FROM constante where nombconstante like ''MINUTOS_EXPIRACAO_CIELO_LINK'') as minutos, + (SELECT valorconstante FROM constante where nombconstante like ''CLIENT_ID_CIELO_LINK'') as client_id, + (SELECT valorconstante FROM constante where nombconstante like ''URL_CIELO_LINK'') as url, + (SELECT valorconstante FROM constante where nombconstante like ''SECRET_CIELO_LINK'') as secret, + 1 as usuario_id, + sysdate as fecmodif, + 1 as activo + from empresa where activo = 1 order by empresa_id) dados'; + exception + when dup_val_on_index then null; + when except_02291 then null; +end; \ No newline at end of file diff --git a/src/db/postgresql/migration/V20221128_1234__AL1183.sql b/src/db/postgresql/migration/V20221128_1234__AL1183.sql new file mode 100644 index 000000000..49379b847 --- /dev/null +++ b/src/db/postgresql/migration/V20221128_1234__AL1183.sql @@ -0,0 +1,28 @@ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate + 'CREATE TABLE EMPRESA_EREDE_CONFIG + ( + EMPRESAEREDE_ID NUMBER(7, 0) NOT NULL + , EMPRESA_ID NUMBER(7, 0) + , FILIATION VARCHAR2(50 BYTE) + , TOKEN VARCHAR2(100 BYTE) + , INDPRODUCAO NUMBER(1,0) + , ACTIVO NUMBER(1,0) + , FECMODIF DATE + , USUARIO_ID NUMBER(7,0) + , CONSTRAINT EMPRESA_EREDE_CONFIG PRIMARY KEY ( EMPRESAEREDE_ID ) ENABLE ) '; + + exception when object_exists then null; +end; +/ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate + 'CREATE SEQUENCE EMP_EREDE_CONFIG_SEQ'; + exception when object_exists then null; +end; diff --git a/src/db/postgresql/migration/V20221128_1235__AL1786.sql b/src/db/postgresql/migration/V20221128_1235__AL1786.sql new file mode 100644 index 000000000..39421f455 --- /dev/null +++ b/src/db/postgresql/migration/V20221128_1235__AL1786.sql @@ -0,0 +1,30 @@ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate + 'CREATE TABLE EMPRESA_CIELOLINK_CONFIG + ( + EMPRESACIELOLINK_ID NUMBER(7, 0) NOT NULL + , EMPRESA_ID NUMBER(7, 0) + , CLIENT_ID VARCHAR2(50 BYTE) + , MERCHANT_ID VARCHAR2(50 BYTE) + , SECRET VARCHAR2(50 BYTE) + , MINUTOS_CANCELA NUMBER(7,0) + , URL VARCHAR2(50 BYTE) + , ACTIVO NUMBER(1,0) + , FECMODIF DATE + , USUARIO_ID NUMBER(7,0) + , CONSTRAINT EMPRESA_CIELOLINK_CONFIG PRIMARY KEY ( EMPRESACIELOLINK_ID ) ENABLE ) '; + + exception when object_exists then null; +end; +/ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate + 'CREATE SEQUENCE EMP_CIELOLINK_CONFIG_SEQ'; + exception when object_exists then null; +end; diff --git a/src/db/postgresql/migration/V20221207_1034__AL-1860.sql b/src/db/postgresql/migration/V20221207_1034__AL-1860.sql new file mode 100644 index 000000000..83ef67012 --- /dev/null +++ b/src/db/postgresql/migration/V20221207_1034__AL-1860.sql @@ -0,0 +1,13 @@ +-- 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 'Insert into AUTORIZACION (AUTORIZACION_ID,NOMBAUTORIZACION,DESCAUTORIZACION,ACTIVO,FECMODIF,USUARIO_ID) values (AUTORIZACION_SEQ.NEXTVAL,''AUT_MAPA_LGPD'',''AUTORIZACAO PARA EXIBIR DADOS LGPD NO MAPA DE VIAGEM'',1,SYSDATE,1)'; + exception + when dup_val_on_index then null; + when except_02291 then null; +end; \ No newline at end of file diff --git a/src/db/postgresql/migration/V20221221_1650__AL-1786.sql b/src/db/postgresql/migration/V20221221_1650__AL-1786.sql new file mode 100644 index 000000000..98ef59e1f --- /dev/null +++ b/src/db/postgresql/migration/V20221221_1650__AL-1786.sql @@ -0,0 +1,28 @@ +-- 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 'Insert into empresa_cielolink_config + (empresacielolink_id, empresa_id, merchant_id, minutos_cancela, client_id, url, secret, usuario_id, fecmodif, activo) + select + EMP_CIELOLINK_CONFIG_SEQ.nextval, empresa_id, merchant_id , minutos , client_id , url , secret , usuario_id , fecmodif, activo from + ( + select + empresa_id, + (SELECT valorconstante FROM constante where nombconstante like ''MERCHANT_ID_CIELO_LINK'') as merchant_id, + (SELECT valorconstante FROM constante where nombconstante like ''MINUTOS_EXPIRACAO_CIELO_LINK'') as minutos, + (SELECT valorconstante FROM constante where nombconstante like ''CLIENT_ID_CIELO_LINK'') as client_id, + (SELECT valorconstante FROM constante where nombconstante like ''URL_CIELO_LINK'') as url, + (SELECT valorconstante FROM constante where nombconstante like ''SECRET_CIELO_LINK'') as secret, + 1 as usuario_id, + sysdate as fecmodif, + 1 as activo + from empresa where activo = 1 order by empresa_id) dados'; + exception + when dup_val_on_index then null; + when except_02291 then null; +end; \ No newline at end of file From 02df3527e65cdb9b585ea745174f0914d12c4932 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Thu, 22 Dec 2022 18:20:16 -0300 Subject: [PATCH 2/2] bug#AL-1786 --- src/db/migration/V20221128_1234__AL1183.sql | 28 --------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/db/migration/V20221128_1234__AL1183.sql diff --git a/src/db/migration/V20221128_1234__AL1183.sql b/src/db/migration/V20221128_1234__AL1183.sql deleted file mode 100644 index 49379b847..000000000 --- a/src/db/migration/V20221128_1234__AL1183.sql +++ /dev/null @@ -1,28 +0,0 @@ -declare - object_exists exception; - pragma exception_init (object_exists , -00955); -begin - execute immediate - 'CREATE TABLE EMPRESA_EREDE_CONFIG - ( - EMPRESAEREDE_ID NUMBER(7, 0) NOT NULL - , EMPRESA_ID NUMBER(7, 0) - , FILIATION VARCHAR2(50 BYTE) - , TOKEN VARCHAR2(100 BYTE) - , INDPRODUCAO NUMBER(1,0) - , ACTIVO NUMBER(1,0) - , FECMODIF DATE - , USUARIO_ID NUMBER(7,0) - , CONSTRAINT EMPRESA_EREDE_CONFIG PRIMARY KEY ( EMPRESAEREDE_ID ) ENABLE ) '; - - exception when object_exists then null; -end; -/ -declare - object_exists exception; - pragma exception_init (object_exists , -00955); -begin - execute immediate - 'CREATE SEQUENCE EMP_EREDE_CONFIG_SEQ'; - exception when object_exists then null; -end;