From 26fcf49d03ea4602da2adf2f32c2e1b5d77e1f71 Mon Sep 17 00:00:00 2001 From: erick.sato Date: Tue, 10 May 2016 16:34:48 -0300 Subject: [PATCH] [Redmine Atendimento #4869]Reset termo responsabilidade --- cit-adm-materiais-api/src/main/resources/scripts-bd/postgres/v1.15.0/01-cit-adm-materiais-v1.15.0-postgres.sql | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/cit-adm-materiais-api/src/main/resources/scripts-bd/postgres/v1.15.0/01-cit-adm-materiais-v1.15.0-postgres.sql b/cit-adm-materiais-api/src/main/resources/scripts-bd/postgres/v1.15.0/01-cit-adm-materiais-v1.15.0-postgres.sql index 521c0e0..b21c799 100644 --- a/cit-adm-materiais-api/src/main/resources/scripts-bd/postgres/v1.15.0/01-cit-adm-materiais-v1.15.0-postgres.sql +++ b/cit-adm-materiais-api/src/main/resources/scripts-bd/postgres/v1.15.0/01-cit-adm-materiais-v1.15.0-postgres.sql @@ -1575,4 +1575,32 @@ CREATE TABLE alm_ee_transferencia_aud CONSTRAINT alm_ee_transferencia_aud_pkey PRIMARY KEY (id, rev) ); --- ERICK FIM 09/05/2016 \ No newline at end of file +-- ERICK FIM 09/05/2016 + +-- ERick INICIO 10/05/2016 +/* + * SCRIPT PARA REMOVER TERMO RESPONSABILIDADE GERADO PELA TRANSFERENCIA E RESET DA NUMERACAO DO TERMO RESPONSABILIDADE + * + * DE ACORDO COM HALINE: + * [16:24:25] Haline Moreira: deixa que eu controlo em qual cliente vamos rodar. + * + +DELETE from TermoResponsabilidade where numerotermo ilike '2016%' AND TRANSFERENCIA_ID IS NOT NULL; + +DO $$ +DECLARE +r record; +BEGIN + +FOR r IN + select id, row_number() OVER (ORDER BY ID) AS num from TermoResponsabilidade where numerotermo ilike '2016%' +LOOP + update TermoResponsabilidade + set numerotermo = '2016'||lpad(r.num::text, 6, '0') + where id = r.id; + +END LOOP; +END$$; + +*/ +-- ERICK FIM 10/05/2016 \ No newline at end of file -- libgit2 0.21.2