diff --git a/pom.xml b/pom.xml index f71c3057c..8b1dfb3b0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 br.com.rjconsultores Flyway - 1.3.6 + 1.3.7 diff --git a/src/db/migration/V20232925_1531__AL-2649.sql b/src/db/migration/V20232925_1531__AL-2649.sql new file mode 100644 index 000000000..2da63ce8e --- /dev/null +++ b/src/db/migration/V20232925_1531__AL-2649.sql @@ -0,0 +1,41 @@ +declare + object_exists exception; + except_00957 exception; + + pragma exception_init (object_exists , -01430); + pragma exception_init (except_00957 , -00957); +begin + execute immediate 'ALTER TABLE COTACAO RENAME COLUMN VALOR TO VALOR_ANTIGO'; + exception + when object_exists then null; + when except_00957 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 COTACAO ADD (VALOR NUMBER(10,7) )'; + 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 'BEGIN FOR COTACAO_ATUAL IN (SELECT VALOR_ANTIGO, COTACAO_ID FROM COTACAO) LOOP UPDATE COTACAO SET VALOR = COTACAO_ATUAL.VALOR_ANTIGO WHERE COTACAO_ID = COTACAO_ATUAL.COTACAO_ID; END LOOP; COMMIT; END;'; +exception + when dup_val_on_index then null; + when except_02291 then null; +end; \ No newline at end of file