From 60e4761137b6bd79ee3b78683aa52e6a4a3e6880 Mon Sep 17 00:00:00 2001 From: frederico Date: Fri, 3 Jan 2020 20:01:01 +0000 Subject: [PATCH] bug#17121 qua:Wallysson dev:Thiago git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@99566 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../migration/V20200103_1045__mantis17121.sql | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 src/db/migration/V20200103_1045__mantis17121.sql diff --git a/src/db/migration/V20200103_1045__mantis17121.sql b/src/db/migration/V20200103_1045__mantis17121.sql new file mode 100644 index 000000000..c1b3c1b47 --- /dev/null +++ b/src/db/migration/V20200103_1045__mantis17121.sql @@ -0,0 +1,129 @@ +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate 'CREATE TABLE COTACAO ( +COTACAO_ID NUMBER(7,0) NOT NULL, +MONEDA_ID NUMBER(7,0), +VALOR NUMBER(10,2), +FECMODIF DATE, +ACTIVO NUMBER(1,0), +USUARIO_ID NUMBER(7,0), +CONSTRAINT COTACAO_PK PRIMARY KEY(COTACAO_ID), +CONSTRAINT COTACAO_MONEDA_FK + FOREIGN KEY (MONEDA_ID) + REFERENCES MONEDA(MONEDA_ID) +)'; + exception when object_exists then null; +end; + +/ + +declare + object_exists exception; + pragma exception_init (object_exists , -00955); +begin + execute immediate 'CREATE SEQUENCE COTACAO_SEQ MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1'; + exception when object_exists 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 'Insert into FUNCION_SISTEMA (FUNCIONSISTEMA_ID,SISTEMA_ID,NOMBFUNCION,DESCRUTA,ACTIVO,FECMODIF,USUARIO_ID) +values (FUNCION_SISTEMA_SEQ.nextval,''1'',''ADM > ADM DE PRECO > COTACAO'',''COM.RJCONSULTORES.ADMINISTRACION.GUI.TARIFAS.MENU.COTACAO'', +''1'',to_date(''23/12/19'',''DD/MM/RR''),''-1'')'; + exception + when dup_val_on_index then null; + when except_02291 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 BOLETO ADD COTACAO_ID NUMBER(7,0)'; + exception + when object_exists then null; + when except_01451 then null; + when except_01442 then null; +end; + + +/ + +declare + object_exists exception; + except_02275 exception; + except_02270 exception; + except_02261 exception; + + pragma exception_init (object_exists , -01430); + pragma exception_init (except_02275 , -02275); + pragma exception_init (except_02270 , -02270); + pragma exception_init (except_02261 , -02261); +begin + execute immediate 'ALTER TABLE BOLETO +ADD CONSTRAINT FK_BOLETO_COTACAO + FOREIGN KEY (COTACAO_ID) + REFERENCES COTACAO (COTACAO_ID)'; + exception + when object_exists then null; + when except_02275 then null; + when except_02270 then null; + when except_02261 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 CAJA ADD COTACAO_ID NUMBER(7,0)'; + exception + when object_exists then null; + when except_01451 then null; + when except_01442 then null; +end; + +/ + +declare + object_exists exception; + except_02275 exception; + except_02270 exception; + except_02261 exception; + + pragma exception_init (object_exists , -01430); + pragma exception_init (except_02275 , -02275); + pragma exception_init (except_02270 , -02270); + pragma exception_init (except_02261 , -02261); +begin + execute immediate 'ALTER TABLE CAJA +ADD CONSTRAINT FK_BOLETO_COTACAO + FOREIGN KEY (COTACAO_ID) + REFERENCES COTACAO (COTACAO_ID)'; + exception + when object_exists then null; + when except_02275 then null; + when except_02270 then null; + when except_02261 then null; +end; \ No newline at end of file