From 01ab15e1dd790645d8065b907d9d729cf40a061e Mon Sep 17 00:00:00 2001 From: wilian Date: Sun, 15 Nov 2020 18:59:29 +0000 Subject: [PATCH] bug#20778 dev:wilian qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@104311 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../migration/V20201114_1836__mantis20778.sql | 37 +++++++++++++++++++ .../migration/V20201102_1545__mantis20776.sql | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/db/migration/V20201114_1836__mantis20778.sql diff --git a/src/db/migration/V20201114_1836__mantis20778.sql b/src/db/migration/V20201114_1836__mantis20778.sql new file mode 100644 index 000000000..5ad8a112f --- /dev/null +++ b/src/db/migration/V20201114_1836__mantis20778.sql @@ -0,0 +1,37 @@ +declare + column_exists exception; + pragma exception_init (column_exists , -01430); +begin + execute immediate 'ALTER TABLE LOG_AUDITORIA ADD ID_AUDITADO_AUX NUMBER(15)'; + exception when column_exists then null; +end; +/ +declare +begin + execute immediate 'UPDATE LOG_AUDITORIA SET ID_AUDITADO_AUX = ID_AUDITADO'; + exception when others then null; +end; +/ +declare +begin + execute immediate 'UPDATE LOG_AUDITORIA SET ID_AUDITADO = NULL'; + exception when others then null; +end; +/ +declare + object_exists exception; + except_00957 exception; + pragma exception_init (object_exists , -01430); + pragma exception_init (except_00957 , -00957); +begin + execute immediate 'ALTER TABLE LOG_AUDITORIA MODIFY ID_AUDITADO VARCHAR2(100)'; + exception + when object_exists then null; + when except_00957 then null; +end; +/ +declare +begin + execute immediate 'UPDATE LOG_AUDITORIA SET ID_AUDITADO = ID_AUDITADO_AUX'; + exception when others then null; +end; \ No newline at end of file diff --git a/src/db/postgresql/migration/V20201102_1545__mantis20776.sql b/src/db/postgresql/migration/V20201102_1545__mantis20776.sql index 1aba0f83c..36053473d 100644 --- a/src/db/postgresql/migration/V20201102_1545__mantis20776.sql +++ b/src/db/postgresql/migration/V20201102_1545__mantis20776.sql @@ -1,6 +1,6 @@ DO $$ BEGIN - ALTER TABLE LOG_AUDITORIA ADD (ID_AUDITADO NUMBER(15)); + ALTER TABLE LOG_AUDITORIA ADD (ID_AUDITADO VARCHAR2(100)); EXCEPTION WHEN duplicate_column THEN NULL; END $$; \ No newline at end of file