1 | /*
|
---|
2 | * ADICIONADO NOVOS CAMPOS
|
---|
3 | *
|
---|
4 | **/
|
---|
5 |
|
---|
6 | ALTER TABLE `tturmaalunoaprovado`
|
---|
7 | ADD `Verificado` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `ID_Aluno` ,
|
---|
8 | ADD `Data_Aprovado` DATE NOT NULL DEFAULT '0000-00-00' AFTER `EnviadoAluno` ,
|
---|
9 | ADD `Data_Verificado` DATE NOT NULL DEFAULT '0000-00-00' AFTER `Data_Aprovado` ,
|
---|
10 | ADD `Data_Remessa` DATE NOT NULL DEFAULT '0000-00-00' AFTER `Data_Verificado` ,
|
---|
11 | ADD `Responsavel_Verificado` INT NOT NULL DEFAULT '0' AFTER `Data_EnviadoAluno` ,
|
---|
12 | ADD `Responsavel_Remessa` INT NOT NULL DEFAULT '0' AFTER `Responsavel_Verificado`
|
---|
13 |
|
---|
14 | /*
|
---|
15 | * ADICIONADO NOVOS CAMPOS
|
---|
16 | *
|
---|
17 | **/
|
---|
18 | ALTER TABLE `tturmaalunocertificado`
|
---|
19 | ADD `ID_Lote_Certificado` INT(11) UNSIGNED NULL AFTER `ID_Turma`
|
---|
20 |
|
---|
21 | /*
|
---|
22 | * CRIADA NOVA TABELA AUXILIAR PARA NÃO PERMITIR DUPLICIDADE DE CERTIFCADO INFORMADO PELA INSTITUIÇÃO
|
---|
23 | *
|
---|
24 | **/
|
---|
25 | CREATE TABLE IF NOT EXISTS `tturmaalunocertificado_aux` (
|
---|
26 | `ID_Certificado` int(11) NOT NULL,
|
---|
27 | `nr_certificado` varchar(20) NULL,
|
---|
28 | `nr_livro` varchar(20) NULL,
|
---|
29 | `nr_folha` varchar(20) NULL,
|
---|
30 | PRIMARY KEY (`ID_Certificado`),
|
---|
31 | UNIQUE KEY `livro_folha` (`nr_certificado`,`nr_livro`,`nr_folha`),
|
---|
32 | KEY `nr_certificado` (`nr_certificado`)
|
---|
33 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
---|
34 |
|
---|
35 | ALTER TABLE `SIS_modelo`.`tturmaalunocertificado_aux`
|
---|
36 | ADD CONSTRAINT `FK_tturmaalunocertificado_aux_1`
|
---|
37 | FOREIGN KEY `FK_tturmaalunocertificado_aux_1` (`ID_Certificado`)
|
---|
38 | REFERENCES `tturmaalunocertificado` (`ID_Certificado`)
|
---|
39 | ON DELETE RESTRICT
|
---|
40 | ON UPDATE RESTRICT
|
---|
41 | , ROW_FORMAT = DYNAMIC;
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * CRIADA NOVA TABELA AUXILIAR PARA IDENTIFICAR O TIPO DE DOCUMENTO EMITIDO
|
---|
45 | *
|
---|
46 | **/
|
---|
47 | CREATE TABLE IF NOT EXISTS `tipo_documento` (
|
---|
48 | `ID_Tipo_Documento` int(11) NOT NULL AUTO_INCREMENT,
|
---|
49 | `Descricao` varchar(100) NOT NULL,
|
---|
50 | PRIMARY KEY (`ID_Tipo_Documento`)
|
---|
51 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
|
---|
52 |
|
---|
53 | INSERT INTO `tipo_documento` (`ID_Tipo_Documento`, `Descricao`)
|
---|
54 | VALUES (1, 'Certificado'),
|
---|
55 | (2, 'Histórico Escolar'),
|
---|
56 | (3, 'Diário Escolar'),
|
---|
57 | (4, 'Declaração'),
|
---|
58 | (5, 'Contrato ');
|
---|
59 |
|
---|
60 | /*
|
---|
61 | * CRIADA NOVA TABELA PARA CONTROLE DE LOTE DE ALUNOS APROVADOS , PARA EMISSÃO DE CERTIFICADOS
|
---|
62 | *
|
---|
63 | **/
|
---|
64 | CREATE TABLE IF NOT EXISTS `lote_documento` (
|
---|
65 | `ID_Lote_Documento` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
---|
66 | `ID_Agente` int(11) NOT NULL,
|
---|
67 | `data_hora` datetime NOT NULL,
|
---|
68 | `nome_lote` varchar(100) DEFAULT NULL,
|
---|
69 | PRIMARY KEY (`ID_Lote_Documento`),
|
---|
70 | KEY `FK_lote_documento_1` (`ID_Agente`)
|
---|
71 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
---|
72 |
|
---|
73 | ALTER TABLE `SIS_modelo`.`lote_documento`
|
---|
74 | ADD CONSTRAINT `FK_lote_documento_1`
|
---|
75 | FOREIGN KEY `FK_lote_documento_1` (`ID_Agente`)
|
---|
76 | REFERENCES `tagente` (`ID_Agente`)
|
---|
77 | ON DELETE RESTRICT
|
---|
78 | ON UPDATE RESTRICT
|
---|
79 | , ROW_FORMAT = DYNAMIC;
|
---|
80 | /*
|
---|
81 | * CRIADA NOVA TABELA AUXILIAR PARA ACOMPANHAR ALTERAÇÕES DE PROCEDIMENTOS
|
---|
82 | *
|
---|
83 | **/
|
---|
84 | CREATE TABLE IF NOT EXISTS `lote_documento_log` (
|
---|
85 | `ID_Lote_Documento_Log` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
---|
86 | `ID_Lote_Documento` int(11) unsigned NOT NULL,
|
---|
87 | `ID_Agente` int(11) NOT NULL,
|
---|
88 | `data_hora` datetime NOT NULL,
|
---|
89 | `Acao` enum('E','R') NOT NULL COMMENT 'E = enviado , R = recebido',
|
---|
90 | `Endereco_IP` int(11) unsigned NOT NULL,
|
---|
91 | PRIMARY KEY (`ID_Lote_Documento_Log`) USING BTREE,
|
---|
92 | KEY `FK_lote_documento_log_1` (`ID_Agente`),
|
---|
93 | KEY `FK_lote_documento_log_2` (`ID_Lote_Documento`)
|
---|
94 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
---|
95 |
|
---|
96 | ALTER TABLE `lote_documento_log`
|
---|
97 | ADD CONSTRAINT `FK_lote_documento_log_1`
|
---|
98 | FOREIGN KEY (`ID_Agente`) REFERENCES `tagente` (`ID_Agente`),
|
---|
99 | ADD CONSTRAINT `FK_lote_documento_log_2`
|
---|
100 | FOREIGN KEY (`ID_Lote_Documento`) REFERENCES `lote_documento` (`ID_Lote_Documento`);
|
---|
101 |
|
---|
102 | /*
|
---|
103 | * CRIADA NOVA TABELA AUXILIAR PARA ACOMPANHAR ALTERAÇÕES DE PROCEDIMENTOS DETALHE POR REGISTRO
|
---|
104 | *
|
---|
105 | **/
|
---|
106 | CREATE TABLE IF NOT EXISTS `lote_documento_log_det` (
|
---|
107 | `ID_Log_Documento` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
---|
108 | `ID_Lote_Documento` int(11) unsigned NOT NULL,
|
---|
109 | `ID_Agente` int(11) NOT NULL,
|
---|
110 | `ID_Turma` int(11) NOT NULL,
|
---|
111 | `ID_Aluno` int(11) NOT NULL,
|
---|
112 | `ID_Tipo_Documento` int(11) NOT NULL,
|
---|
113 | `data_hora` datetime NOT NULL,
|
---|
114 | `Acao` enum('E','R','C') NOT NULL COMMENT 'E= enviado, R = recebido, C = cancelado',
|
---|
115 | `Endereco_IP` int(11) unsigned NOT NULL,
|
---|
116 | `Justificativa` text NOT NULL,
|
---|
117 | PRIMARY KEY (`ID_Log_Documento`),
|
---|
118 | KEY `FK_lote_documento_log_det_1` (`ID_Lote_Documento`),
|
---|
119 | KEY `FK_lote_documento_log_det_2` (`ID_Agente`),
|
---|
120 | KEY `FK_lote_documento_log_det_3` (`ID_Turma`),
|
---|
121 | KEY `FK_lote_documento_log_det_4` (`ID_Aluno`),
|
---|
122 | KEY `FK_lote_documento_log_det_5` (`ID_Tipo_Documento`)
|
---|
123 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
---|
124 |
|
---|
125 | ALTER TABLE `lote_documento_log_det`
|
---|
126 | ADD CONSTRAINT `FK_lote_documento_log_det_1`
|
---|
127 | FOREIGN KEY (`ID_Lote_Documento`) REFERENCES `lote_documento` (`ID_Lote_Documento`),
|
---|
128 | ADD CONSTRAINT `FK_lote_documento_log_det_2`
|
---|
129 | FOREIGN KEY (`ID_Agente`) REFERENCES `tagente` (`ID_Agente`),
|
---|
130 | ADD CONSTRAINT `FK_lote_documento_log_det_3`
|
---|
131 | FOREIGN KEY (`ID_Turma`) REFERENCES `tturma` (`ID_Turma`),
|
---|
132 | ADD CONSTRAINT `FK_lote_documento_log_det_4`
|
---|
133 | FOREIGN KEY (`ID_Aluno`) REFERENCES `taluno` (`ID_Aluno`),
|
---|
134 | ADD CONSTRAINT `FK_lote_documento_log_det_5`
|
---|
135 | FOREIGN KEY (`ID_Tipo_Documento`) REFERENCES `tipo_documento` (`ID_Tipo_Documento`);
|
---|