Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
/*========tur===================================================*/
2
/* DBMS name:     PostgreSQL 8                                  */
3
/* Criado em:     13/03/2016                                        */
4
/* Autor: Bruno Lopes Peixoto                                       */
5
/*==============================================================*/
6
 
7
SET search_path = sc_sec;
8
 
9
ALTER TABLE sec_conta_a_pagar ADD COLUMN seq_pessoa INT8;
10
 
11
ALTER TABLE sec_conta_a_pagar
12
   ADD CONSTRAINT fk_contaapagar_pessoa FOREIGN KEY (seq_pessoa)
13
      REFERENCES sec_pessoa (seq_pessoa)
14
      ON DELETE RESTRICT ON UPDATE RESTRICT;
15
 
16
/*==============================================================*/
17
/* Index: ix_contaapagar_pessoa                                     */
18
/*==============================================================*/
19
CREATE  INDEX ix_contaapagar_pessoa ON sec_conta_a_pagar (
20
seq_pessoa
21
);
22
 
23
UPDATE sec_conta_a_pagar cp SET seq_pessoa = (SELECT (r.seq_pessoa) FROM sec_responsavel r WHERE r.seq_responsavel = cp.seq_responsavel);
24
 
25
DROP INDEX ix_contaapagar_responsavel;
26
ALTER TABLE sec_conta_a_pagar DROP COLUMN seq_responsavel;
27
 
28
ALTER TABLE sec_conta_a_receber ADD COLUMN seq_pessoa INT8;
29
 
30
ALTER TABLE sec_conta_a_receber
31
   ADD CONSTRAINT fk_contaareceber_pessoa FOREIGN KEY (seq_pessoa)
32
      REFERENCES sec_pessoa (seq_pessoa)
33
      ON DELETE RESTRICT ON UPDATE RESTRICT;
34
 
35
/*==============================================================*/
36
/* Index: ix_contaareceber_pessoa                                     */
37
/*==============================================================*/
38
CREATE  INDEX ix_contaareceber_pessoa ON sec_conta_a_receber (
39
seq_pessoa
40
);
41
 
42
UPDATE sec_conta_a_receber cp SET seq_pessoa = (SELECT (r.seq_pessoa) FROM sec_responsavel r WHERE r.seq_responsavel = cp.seq_responsavel);
43
 
44
DROP INDEX ix_contaareceber_responsavel;
45
ALTER TABLE sec_conta_a_receber DROP COLUMN seq_responsavel;
46
 
47
DROP TABLE sec_responsavel;
48
 
49
SET search_path = public;