diff --git a/src/db/migration/V20201020_0954__mantis20203.sql b/src/db/migration/V20201020_0954__mantis20203.sql new file mode 100644 index 000000000..f9fc9e71b --- /dev/null +++ b/src/db/migration/V20201020_0954__mantis20203.sql @@ -0,0 +1,15 @@ +declare + column_exists exception; + pragma exception_init (column_exists , -01430); +begin + execute immediate 'ALTER TABLE PTOVTA_COMISSAO ADD COMISSAOIMPPOSTERIOR VARCHAR(20)'; + exception when column_exists then null; +end; +/ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate 'update PTOVTA_COMISSAO set COMISSAOIMPPOSTERIOR = ''PADRAO'' where COMISSAOIMPPOSTERIOR is null'; + exception when object_exists then null; +end; \ No newline at end of file diff --git a/src/db/migration/V20201020_1138__mantis20203.sql b/src/db/migration/V20201020_1138__mantis20203.sql new file mode 100644 index 000000000..ff2e1e2b3 --- /dev/null +++ b/src/db/migration/V20201020_1138__mantis20203.sql @@ -0,0 +1,10 @@ +declare + column_exists exception; + pragma exception_init (column_exists , -01430); +begin + execute immediate 'ALTER TABLE PTOVTA_COMISSAO ADD (VALOR_IMP_GAP_COMP NUMBER(5,2), + VALOR_IMP_GAP_ALTA_COMP NUMBER(5,2), + VALOR_VENDA_GAP_COMP NUMBER(5,2), + VALOR_VENDA_GAP_ALTA_COMP NUMBER(5,2))'; + exception when column_exists then null; +end; \ No newline at end of file diff --git a/src/db/postgresql/migration/V20201020_0954__mantis20203.sql b/src/db/postgresql/migration/V20201020_0954__mantis20203.sql new file mode 100644 index 000000000..92a532144 --- /dev/null +++ b/src/db/postgresql/migration/V20201020_0954__mantis20203.sql @@ -0,0 +1,13 @@ +DO $$ +BEGIN + ALTER TABLE PTOVTA_COMISSAO ADD COMISSAOIMPPOSTERIOR VARCHAR(20); + EXCEPTION WHEN duplicate_column THEN NULL; +END +$$; +/ +DO $$ +BEGIN + update PTOVTA_COMISSAO set COMISSAOIMPPOSTERIOR = 'PADRAO' where COMISSAOIMPPOSTERIOR is null; + EXCEPTION WHEN duplicate_column THEN NULL; +END +$$; \ No newline at end of file diff --git a/src/db/postgresql/migration/V20201020_1138__mantis20203.sql b/src/db/postgresql/migration/V20201020_1138__mantis20203.sql new file mode 100644 index 000000000..351bea41e --- /dev/null +++ b/src/db/postgresql/migration/V20201020_1138__mantis20203.sql @@ -0,0 +1,9 @@ +DO $$ +BEGIN + ALTER TABLE PTOVTA_COMISSAO ADD (VALOR_IMP_GAP_COMP NUMBER(5,2), + VALOR_IMP_GAP_ALTA_COMP NUMBER(5,2), + VALOR_VENDA_GAP_COMP NUMBER(5,2), + VALOR_VENDA_GAP_ALTA_COMP NUMBER(5,2)); + EXCEPTION WHEN duplicate_column THEN NULL; +END +$$; \ No newline at end of file