diff --git a/src/db/migration/V20191028_1712__mantis16732.sql b/src/db/migration/V20191028_1712__mantis16732.sql new file mode 100644 index 000000000..e9010dab8 --- /dev/null +++ b/src/db/migration/V20191028_1712__mantis16732.sql @@ -0,0 +1,7 @@ +declare + column_exists exception; + pragma exception_init (column_exists , -01430); +begin + execute immediate 'ALTER TABLE INSCRICAO_ESTADUAL ADD (ORIGEM_ID_IEDESCENTRALIZADA NUMBER(7), INDHABILITAIEDESCENTRALIZADA NUMBER(1))'; + exception when column_exists then null; +end; \ No newline at end of file diff --git a/src/db/migration/V20191028_1713__mantis16732.sql b/src/db/migration/V20191028_1713__mantis16732.sql new file mode 100644 index 000000000..be8f5e999 --- /dev/null +++ b/src/db/migration/V20191028_1713__mantis16732.sql @@ -0,0 +1,6 @@ +declare + begin + execute immediate 'INSERT INTO CUSTOM (CUSTOM_ID, SISTEMA, CHAVE, VALOR, ACTIVO, FECMODIF, USUARIO_ID) + VALUES (CUSTOM_SEQ.nextval, 3, ''isHabilitaIEDescentralizada'', ''0'', 0, sysdate, 1)'; + exception when others then null; +end; \ No newline at end of file diff --git a/src/db/migration/V20191028_1714__mantis16732.sql b/src/db/migration/V20191028_1714__mantis16732.sql new file mode 100644 index 000000000..7dee2a994 --- /dev/null +++ b/src/db/migration/V20191028_1714__mantis16732.sql @@ -0,0 +1,18 @@ +declare + object_exists exception; + except_02275 exception; + except_02270 exception; + except_02261 exception; + + pragma exception_init (object_exists , -01430); + pragma exception_init (except_02275 , -02275); + pragma exception_init (except_02270 , -02270); + pragma exception_init (except_02261 , -02261); +begin + execute immediate 'ALTER TABLE INSCRICAO_ESTADUAL ADD CONSTRAINTS ORIGEM_ID_IEDESC_FK FOREIGN KEY(ORIGEM_ID_IEDESCENTRALIZADA) REFERENCES PARADA(PARADA_ID)'; + exception + when object_exists then null; + when except_02275 then null; + when except_02270 then null; + when except_02261 then null; +end; \ No newline at end of file diff --git a/src/db/postgresql/migration/V20191028_1712__mantis16732.sql b/src/db/postgresql/migration/V20191028_1712__mantis16732.sql new file mode 100644 index 000000000..cad9e7b4b --- /dev/null +++ b/src/db/postgresql/migration/V20191028_1712__mantis16732.sql @@ -0,0 +1,6 @@ +DO $$ +BEGIN + ALTER TABLE INSCRICAO_ESTADUAL ADD (ORIGEM_ID_IEDESCENTRALIZADA NUMBER(7), INDHABILITAIEDESCENTRALIZADA NUMBER(1)); + EXCEPTION WHEN duplicate_column THEN NULL; +END +$$; \ No newline at end of file diff --git a/src/db/postgresql/migration/V20191028_1713__mantis16732.sql b/src/db/postgresql/migration/V20191028_1713__mantis16732.sql new file mode 100644 index 000000000..aecf9ecf8 --- /dev/null +++ b/src/db/postgresql/migration/V20191028_1713__mantis16732.sql @@ -0,0 +1,10 @@ +DO $$ +BEGIN + INSERT INTO CUSTOM (CUSTOM_ID, SISTEMA, CHAVE, VALOR, ACTIVO, FECMODIF, USUARIO_ID) + VALUES (nextval('custom_seq'), 3, 'isHabilitaIEDescentralizada', '0', 0, now(), 1); + + EXCEPTION + WHEN OTHERS THEN NULL; + WHEN unique_violation THEN NULL; +END +$$; \ No newline at end of file