From 4b1330c92a3c5839167150b762a884e54093d8cf Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Mon, 13 Feb 2023 16:20:26 -0300 Subject: [PATCH] =?UTF-8?q?GLPI=2060358=20-=20Erro=20ao=20alterar=20c?= =?UTF-8?q?=C3=B3digo=20ANTT=20de=20localidade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remoção e reescrita de index unico do codigo antt das paradas, para utilização quando registro deletado logicamente fixes bug#AL-2145 --- pom.xml | 2 +- src/db/migration/V20230213_1155__AL-2145.sql | 19 +++++++++++++++++++ .../migration/V20230213_1155__AL-2145.sql | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/db/migration/V20230213_1155__AL-2145.sql create mode 100644 src/db/postgresql/migration/V20230213_1155__AL-2145.sql diff --git a/pom.xml b/pom.xml index 4f8cef432..5eb5594eb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 br.com.rjconsultores Flyway - 1.0.21 + 1.0.22 diff --git a/src/db/migration/V20230213_1155__AL-2145.sql b/src/db/migration/V20230213_1155__AL-2145.sql new file mode 100644 index 000000000..7882ca4ca --- /dev/null +++ b/src/db/migration/V20230213_1155__AL-2145.sql @@ -0,0 +1,19 @@ +declare + indice_nao_existe exception; + pragma exception_init (indice_nao_existe , -01418); +begin + execute immediate 'DROP INDEX UNIQUE_CODANTT'; + exception when indice_nao_existe then null; +end; +/ +DECLARE + object_exists exception; + except_01408 exception; + pragma exception_init (object_exists , -00955); + pragma exception_init (except_01408 , -01408); +BEGIN + execute IMMEDIATE 'CREATE UNIQUE INDEX UNIQUE_CODANTT ON PARADA (CASE WHEN ACTIVO = 1 THEN CODANTT ELSE NULL END)'; + exception + when object_exists THEN null; + when except_01408 THEN null; +END; \ No newline at end of file diff --git a/src/db/postgresql/migration/V20230213_1155__AL-2145.sql b/src/db/postgresql/migration/V20230213_1155__AL-2145.sql new file mode 100644 index 000000000..22c8d04cd --- /dev/null +++ b/src/db/postgresql/migration/V20230213_1155__AL-2145.sql @@ -0,0 +1,19 @@ +declare + indice_nao_existe exception; + pragma exception_init (indice_nao_existe , -01418); +begin + execute immediate 'DROP INDEX UNIQUE_CODANTT;'; + exception when indice_nao_existe then null; +end; +/ +DECLARE + object_exists exception; + except_01408 exception; + pragma exception_init (object_exists , -00955); + pragma exception_init (except_01408 , -01408); +BEGIN + execute IMMEDIATE 'CREATE UNIQUE INDEX UNIQUE_CODANTT ON PARADA (CASE WHEN ACTIVO = 1 THEN CODANTT ELSE NULL END)'; + exception + when object_exists THEN null; + when except_01408 THEN null; +END; \ No newline at end of file