· 7 years ago · Jan 16, 2019, 06:40 AM
1create table if not exists rhu.bancoconvenio
2(
3 id integer
4 constraint bancoconvenio_pk
5 unique,
6 idorgao integer,
7 nome varchar(50),
8 tipo integer,
9 idbanco integer,
10 agenciadigito varchar(50),
11 agenciacodigo integer,
12 contacodigo integer,
13 contadigito integer,
14 classecode integer
15 );
16
17alter table if exists rhu.bancoconvenio
18 add constraint fk_idbanco
19 foreign key (idbanco) references rhu.banco;
20
21alter table if exists rhu.bancoconvenio
22 add constraint fk_idclasscode
23 foreign key (classecode) references rhu.classcode;
24
25alter table if exists rhu.bancoconvenio
26 add constraint fk_idorgao
27 foreign key (idorgao) references public.orgao;
28
29alter table if exists rhu.bancoconvenio
30 rename column classecode to idclassecode;
31
32alter table if exists rhu.bancoconvenio
33alter column agenciadigito type INTEGER using agenciadigito::INTEGER;
34
35alter table if exists rhu.bancoconvenio
36 add dataalteracao timestamp;
37
38alter table if exists rhu.bancoconvenio
39 add datacadastro timestamp;
40
41alter table if exists rhu.bancoconvenio
42 add idusuarioalteracao integer;
43
44alter table if exists rhu.bancoconvenio
45 add idusuariocadastro integer;
46
47alter table if exists rhu.bancoconvenio
48 add status integer;
49
50alter table if exists rhu.bancoconvenio
51 add version integer;
52
53-- auto-generated definition
54create sequence bancoconvenio_id_seq;
55
56alter sequence bancoconvenio_id_seq;