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