GRH_007.sql
8.22 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
/*
**********************************************************************************
* *
* @package URBEM CNM - Soluções em Gestão Pública *
* @copyright (c) 2013 Confederação Nacional de Municípos *
* @author Confederação Nacional de Municípios *
* *
* O URBEM CNM é um software livre; você pode redistribuí-lo e/ou modificá-lo sob *
* os termos da Licença Pública Geral GNU conforme publicada pela Fundação do *
* Software Livre (FSF - Free Software Foundation); na versão 2 da Licença. *
* *
* Este programa é distribuído na expectativa de que seja útil, porém, *
* SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU *
* ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral do GNU *
* para mais detalhes. *
* *
* Você deve ter recebido uma cópia da Licença Pública Geral do GNU "LICENCA.txt" *
* com este programa; se não, escreva para a Free Software Foundation Inc., *
* no endereço 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* *
**********************************************************************************
*/
/*
* Script de DDL e DML
*
* URBEM Soluções de Gestão Pública Ltda
* www.urbem.cnm.org.br
*
* $Revision: 28350 $
* $Name$
* $Author: gris $
* $Date: 2008-03-05 09:57:44 -0300 (Qua, 05 Mar 2008) $
*
* Versão 006.
*/
CREATE TABLE administracao.buffers_texto (
buffer varchar(50) NOT NULL,
valor varchar(50) NOT NULL,
CONSTRAINT pk_buffers_texto PRIMARY KEY(buffer)
);
GRANT INSERT, DELETE, UPDATE, SELECT ON administracao.buffers_texto TO GROUP urbem;
CREATE TABLE administracao.buffers_inteiro (
buffer varchar(50) NOT NULL,
valor integer NOT NULL,
CONSTRAINT pk_buffers_inteiro PRIMARY KEY(buffer)
);
GRANT INSERT, DELETE, UPDATE, SELECT ON administracao.buffers_inteiro TO GROUP urbem;
CREATE TABLE administracao.buffers_numerico (
buffer varchar(50) NOT NULL,
valor numeric(15,2) NOT NULL,
CONSTRAINT pk_buffers_numerico PRIMARY KEY(buffer)
);
GRANT INSERT, DELETE, UPDATE, SELECT ON administracao.buffers_numerico TO GROUP urbem;
CREATE TABLE administracao.buffers_timestamp (
buffer varchar(50) NOT NULL,
valor timestamp NOT NULL,
CONSTRAINT pk_buffers_timestamp PRIMARY KEY(buffer)
);
GRANT INSERT, DELETE, UPDATE, SELECT ON administracao.buffers_timestamp TO GROUP urbem;
--Folha Salário
select atualizarBanco('
CREATE TABLE folhapagamento.registro_evento_fixos(
cod_evento integer not null,
codigo character(5) not null,
cod_registro integer not null,
cod_contrato integer not null,
valor numeric(15,2) not null,
quantidade numeric(15,2) not null,
proporcional boolean not null,
parcela integer,
cod_periodo_movimentacao integer not null,
timestamp timestamp without time zone not null,
formula varchar(10),
natureza character(1) not null,
cod_configuracao integer not null
);');
select atualizarBanco('
GRANT INSERT, DELETE, UPDATE, SELECT ON folhapagamento.registro_evento_fixos TO GROUP urbem;');
select atualizarBanco('
CREATE INDEX i_registro_evento_fixos
ON folhapagamento.registro_evento_fixos
( cod_evento
, codigo
, cod_registro
, cod_contrato
, proporcional
, cod_periodo_movimentacao
, timestamp
, natureza
, cod_configuracao);');
select atualizarBanco('
CREATE TABLE folhapagamento.registro_evento_ordenado(
cod_evento integer not null,
codigo character(5) not null,
cod_registro integer not null,
cod_contrato integer not null,
valor numeric(15,2) not null,
quantidade numeric(15,2) not null,
proporcional boolean not null,
parcela integer,
cod_periodo_movimentacao integer not null,
timestamp timestamp without time zone not null,
formula varchar(10),
natureza character(1) not null,
cod_configuracao integer not null,
sequencia integer not null
);');
select atualizarBanco('
GRANT INSERT, DELETE, UPDATE, SELECT ON folhapagamento.registro_evento_ordenado TO GROUP urbem;');
select atualizarBanco('
CREATE INDEX i_registro_evento_ordenado
ON folhapagamento.registro_evento_ordenado
( cod_evento
, codigo
, cod_registro
, cod_contrato
, proporcional
, cod_periodo_movimentacao
, timestamp
, natureza
, cod_configuracao);');
--Folha Salário
--Folha Férias
select atualizarBanco('
CREATE TABLE folhapagamento.registro_evento_ferias_ordenado(
cod_evento integer not null,
codigo character(5) not null,
cod_registro integer not null,
cod_contrato integer not null,
valor numeric(15,2) not null,
quantidade numeric(15,2) not null,
desdobramento character(1) not null,
parcela integer,
cod_periodo_movimentacao integer not null,
timestamp timestamp without time zone not null,
natureza character(1) not null,
evento_sistema character(3),
sequencia integer not null
);');
select atualizarBanco('
GRANT INSERT, DELETE, UPDATE, SELECT ON folhapagamento.registro_evento_ferias_ordenado TO GROUP urbem;');
select atualizarBanco('
CREATE INDEX i_registro_evento_ferias_ordenado
ON folhapagamento.registro_evento_ferias_ordenado
( cod_evento
, codigo
, cod_registro
, cod_contrato
, desdobramento
, cod_periodo_movimentacao
, timestamp
, natureza
);');
--Folha Férias
--Folha Rescisao
select atualizarBanco('
CREATE TABLE folhapagamento.registro_evento_rescisao_ordenado(
cod_evento integer not null,
codigo character(5) not null,
cod_registro integer not null,
cod_contrato integer not null,
valor numeric(15,2) not null,
quantidade numeric(15,2) not null,
desdobramento character(1) not null,
parcela integer,
cod_periodo_movimentacao integer not null,
timestamp timestamp without time zone not null,
natureza character(1) not null,
sequencia integer not null
);');
select atualizarBanco('
GRANT INSERT, DELETE, UPDATE, SELECT ON folhapagamento.registro_evento_rescisao_ordenado TO GROUP urbem;');
select atualizarBanco('
CREATE INDEX i_registro_evento_rescisao_ordenado
ON folhapagamento.registro_evento_rescisao_ordenado
( cod_evento
, codigo
, cod_registro
, cod_contrato
, desdobramento
, cod_periodo_movimentacao
, timestamp
, natureza
);');
--Folha Rescisao
--Folha Descimo
select atualizarBanco('
CREATE TABLE folhapagamento.registro_evento_decimo_ordenado(
cod_evento integer not null,
codigo character(5) not null,
cod_registro integer not null,
cod_contrato integer not null,
valor numeric(15,2) not null,
quantidade numeric(15,2) not null,
desdobramento character(1) not null,
parcela integer,
cod_periodo_movimentacao integer not null,
timestamp timestamp without time zone not null,
natureza character(1) not null,
sequencia integer not null
);');
select atualizarBanco('
GRANT INSERT, DELETE, UPDATE, SELECT ON folhapagamento.registro_evento_decimo_ordenado TO GROUP urbem;');
select atualizarBanco('
CREATE INDEX i_registro_evento_decimo_ordenado
ON folhapagamento.registro_evento_decimo_ordenado
( cod_evento
, codigo
, cod_registro
, cod_contrato
, desdobramento
, cod_periodo_movimentacao
, timestamp
, natureza
); ');
--Folha Descimo