install.sql
1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-- Referências para aluno e docente i-Educar x Educacenso.
CREATE TABLE modules.educacenso_cod_aluno
(
cod_aluno integer NOT NULL,
cod_aluno_inep bigint NOT NULL,
nome_inep character varying(255),
fonte character varying(255),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone
) WITH (OIDS=FALSE);
ALTER TABLE modules.educacenso_cod_aluno ADD
CONSTRAINT educacenso_cod_aluno_pk
PRIMARY KEY (cod_aluno, cod_aluno_inep);
ALTER TABLE modules.educacenso_cod_aluno ADD
CONSTRAINT educacenso_cod_aluno_cod_aluno_fk
FOREIGN KEY (cod_aluno) REFERENCES pmieducar.aluno (cod_aluno)
ON UPDATE NO ACTION ON DELETE CASCADE;
CREATE TABLE modules.educacenso_cod_docente
(
cod_servidor integer NOT NULL,
cod_docente_inep bigint NOT NULL,
nome_inep character varying(255),
fonte character varying(255),
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone
) WITH (OIDS=FALSE);
ALTER TABLE modules.educacenso_cod_docente ADD
CONSTRAINT educacenso_cod_docente_pk
PRIMARY KEY (cod_servidor, cod_docente_inep);
-- Tabelas para armazenar nome das IES e cursos superiores de acordo com os
-- dados do Educacenso/Inep.
CREATE TABLE modules.educacenso_ies
(
id serial,
ies_id integer NOT NULL,
nome character varying(255) NOT NULL,
dependencia_administrativa_id integer NOT NULL,
tipo_instituicao_id integer NOT NULL,
uf character(2),
user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone,
CONSTRAINT educacenso_ies_pk PRIMARY KEY (id)
) WITH (OIDS=FALSE);
CREATE TABLE modules.educacenso_curso_superior
(
id serial,
curso_id character varying(100) NOT NULL,
nome character varying(255) NOT NULL,
classe_id integer NOT NULL,
user_id integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone,
CONSTRAINT educacenso_curso_superior_pk PRIMARY KEY (id)
) WITH (OIDS=FALSE);