1 |
-- |
-- |
2 |
|
-- Ajout de table: avis_consultation_tmp; |
3 |
|
-- |
4 |
|
|
5 |
|
|
6 |
|
CREATE TABLE avis_consultation_tmp ( |
7 |
|
avis character varying(2) NOT NULL, |
8 |
|
libelle character varying(30) NOT NULL, |
9 |
|
typeavis character(1) DEFAULT ''::bpchar NOT NULL, |
10 |
|
sitadel character(1) DEFAULT ''::bpchar NOT NULL, |
11 |
|
sitadel_motif character(1) DEFAULT ''::bpchar NOT NULL |
12 |
|
); |
13 |
|
|
14 |
|
|
15 |
|
-- |
16 |
|
-- Data for Name: avis_consultation_tmp; |
17 |
|
-- |
18 |
|
|
19 |
|
INSERT INTO avis_consultation_tmp VALUES ('D', 'Defavorable', 'D', '6', ' '); |
20 |
|
INSERT INTO avis_consultation_tmp VALUES ('F', 'Favorable', 'F', '4', ' '); |
21 |
|
INSERT INTO avis_consultation_tmp VALUES ('F1', 'Favorable avec Reserve', 'F', '4', ' '); |
22 |
|
INSERT INTO avis_consultation_tmp VALUES ('T', 'Tacite', 'F', '2', ' '); |
23 |
|
INSERT INTO avis_consultation_tmp VALUES ('A', 'Autre', ' ', '7', ' '); |
24 |
|
|
25 |
|
|
26 |
|
-- |
27 |
-- Ajout de la table 'service_categorie' |
-- Ajout de la table 'service_categorie' |
28 |
-- |
-- |
29 |
CREATE TABLE service_categorie ( |
CREATE TABLE service_categorie ( |
66 |
ALTER TABLE service ADD COLUMN notification_email boolean; |
ALTER TABLE service ADD COLUMN notification_email boolean; |
67 |
ALTER TABLE service ADD COLUMN om_validite_debut date; |
ALTER TABLE service ADD COLUMN om_validite_debut date; |
68 |
ALTER TABLE service ADD COLUMN om_validite_fin date; |
ALTER TABLE service ADD COLUMN om_validite_fin date; |
69 |
ALTER TABLE service ADD COLUMN type_consultation varchar(70); |
ALTER TABLE service ADD COLUMN type_consultation varchar(70) NOT NULL DEFAULT 'avec_avis_attendu'; |
70 |
|
|
71 |
ALTER TABLE service RENAME COLUMN service_old TO abrege; |
ALTER TABLE service RENAME COLUMN service_old TO abrege; |
72 |
ALTER TABLE consultation DROP COLUMN service_old; |
ALTER TABLE consultation DROP COLUMN service_old; |
169 |
|
|
170 |
ALTER TABLE avis_consultation ADD COLUMN avis_consultation integer NOT NULL DEFAULT nextval('avis_consultation_seq'::regclass); |
ALTER TABLE avis_consultation ADD COLUMN avis_consultation integer NOT NULL DEFAULT nextval('avis_consultation_seq'::regclass); |
171 |
INSERT INTO avis_consultation(avis_old, libelle) SELECT avis, libelle |
INSERT INTO avis_consultation(avis_old, libelle) SELECT avis, libelle |
172 |
FROM avis; |
FROM avis_consultation_tmp; |
173 |
|
|
174 |
|
|
175 |
ALTER TABLE ONLY avis_decision |
ALTER TABLE ONLY avis_decision |
225 |
ALTER TABLE avis_decision DROP COLUMN avis_old; |
ALTER TABLE avis_decision DROP COLUMN avis_old; |
226 |
ALTER TABLE avis_consultation DROP COLUMN avis_old; |
ALTER TABLE avis_consultation DROP COLUMN avis_old; |
227 |
DROP TABLE avis; |
DROP TABLE avis; |
228 |
|
DROP TABLE avis_consultation_tmp; |
229 |
|
|
230 |
-- |
-- |
231 |
-- Ajout des droits sur l'objet consultation_encours |
-- Ajout des droits sur l'objet consultation_encours |
232 |
-- |
-- |
233 |
|
|
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_encours', 2); |
|
234 |
|
|
235 |
INSERT INTO om_widget VALUES (1, 1, 'Retours de consultations', '../scr/tab.php?obj=consultation_encours', '<script type=''text/javascript''> |
INSERT INTO om_widget VALUES (1, 1, 'Retours de consultations', '../scr/tab.php?obj=consultation_mes_retours', '<script type=''text/javascript''> |
236 |
$.ajax({ |
$.ajax({ |
237 |
type: ''GET'', |
type: ''GET'', |
238 |
url:''../app/get_num_consult.php'', |
url:''../app/get_num_consult.php'', |
251 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_decision', '4'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_decision', '4'); |
252 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_consultation', '4'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_consultation', '4'); |
253 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_service_categorie', '4'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_service_categorie', '4'); |
254 |
|
|
255 |
|
ALTER TABLE consultation ALTER service SET NOT NULL; |
256 |
|
ALTER TABLE dossier ADD COLUMN enjeu boolean; |
257 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_mes_retours', 4); |
258 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_tous_retours', 4); |
259 |
|
|
260 |
|
-- |
261 |
|
-- Modification de la structure des instructeurs |
262 |
|
-- |
263 |
|
CREATE SEQUENCE direction_seq |
264 |
|
START WITH 1 |
265 |
|
INCREMENT BY 1 |
266 |
|
NO MINVALUE |
267 |
|
NO MAXVALUE |
268 |
|
CACHE 1; |
269 |
|
|
270 |
|
CREATE TABLE direction ( |
271 |
|
direction integer NOT NULL, |
272 |
|
code character varying(20) NOT NULL, |
273 |
|
libelle character varying(100) NOT NULL, |
274 |
|
description text, |
275 |
|
chef character varying(100) NOT NULL, |
276 |
|
om_validite_debut date, |
277 |
|
om_validite_fin date, |
278 |
|
PRIMARY KEY (direction) |
279 |
|
); |
280 |
|
|
281 |
|
INSERT INTO direction VALUES (nextval('direction_seq'::regclass),'ADS', 'Direction ADS', 'Direction des autorisations des droits du sol', 'Mme Dupont', NULL, NULL); |
282 |
|
|
283 |
|
CREATE SEQUENCE division_seq |
284 |
|
START WITH 1 |
285 |
|
INCREMENT BY 1 |
286 |
|
NO MINVALUE |
287 |
|
NO MAXVALUE |
288 |
|
CACHE 1; |
289 |
|
|
290 |
|
CREATE TABLE division ( |
291 |
|
division integer NOT NULL, |
292 |
|
code character varying(20) NOT NULL, |
293 |
|
libelle character varying(100) NOT NULL, |
294 |
|
description text, |
295 |
|
chef character varying(100) NOT NULL, |
296 |
|
direction integer NOT NULL, |
297 |
|
om_validite_debut date, |
298 |
|
om_validite_fin date, |
299 |
|
PRIMARY KEY (division), |
300 |
|
FOREIGN KEY ( direction ) REFERENCES direction ( direction ) |
301 |
|
); |
302 |
|
|
303 |
|
INSERT INTO division VALUES (nextval('division_seq'::regclass),'Defaut', 'Division par defaut', '', 'Mme Dupont',1, NULL, NULL); |
304 |
|
|
305 |
|
CREATE SEQUENCE instructeur_seq |
306 |
|
START WITH 1 |
307 |
|
INCREMENT BY 1 |
308 |
|
NO MINVALUE |
309 |
|
NO MAXVALUE |
310 |
|
CACHE 1; |
311 |
|
|
312 |
|
CREATE TABLE instructeur ( |
313 |
|
instructeur integer NOT NULL, |
314 |
|
nom character varying(100) NOT NULL, |
315 |
|
telephone character varying(14), |
316 |
|
division integer NOT NULL, |
317 |
|
om_utilisateur integer, |
318 |
|
om_validite_debut date, |
319 |
|
om_validite_fin date, |
320 |
|
PRIMARY KEY ( instructeur ), |
321 |
|
FOREIGN KEY ( division ) REFERENCES division ( division ), |
322 |
|
FOREIGN KEY ( om_utilisateur ) REFERENCES om_utilisateur ( om_utilisateur ) |
323 |
|
); |
324 |
|
|
325 |
|
-- Insertion des utilisateurs instructeurs dans la table instructeur |
326 |
|
INSERT INTO instructeur (instructeur,nom,telephone,division,om_utilisateur) |
327 |
|
(SELECT om_utilisateur,nom,telephone,1,om_utilisateur FROM om_utilisateur WHERE instructeur='Oui'); |
328 |
|
-- Mise a jour de la sequence |
329 |
|
SELECT setval('instructeur_seq',(SELECT MAX(instructeur) FROM instructeur)); |
330 |
|
|
331 |
|
-- Creation du parametre pour afficher ou non la division dans les dossiers |
332 |
|
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'afficher_division','false',1); |
333 |
|
|
334 |
|
-- Ajout des droits sur les tables d'organisation |
335 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'direction', '2'); |
336 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'division', '2'); |
337 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'instructeur', '2'); |
338 |
|
|
339 |
|
-- Modification de la clé étrangère dossier -> om_utilisateur par dossier -> instructeur |
340 |
|
ALTER TABLE dossier DROP CONSTRAINT dossier_instructeur_fkey; |
341 |
|
ALTER TABLE dossier ADD CONSTRAINT |
342 |
|
dossier_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
343 |
|
|
344 |
|
-- Ajout des parametres des liens dans la table om_parametre |
345 |
|
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'lien_interne_vdm', '',1); |
346 |
|
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'lien_externe', '',1); |
347 |
|
ALTER TABLE om_parametre ALTER COLUMN valeur TYPE character varying(150); |
348 |
|
|
349 |
|
|
350 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2'); |
351 |
|
|
352 |
|
-- |
353 |
|
-- Ajout des tables arrondissement, quartier et lien_localisation_nature |
354 |
|
-- |
355 |
|
CREATE TABLE arrondissement ( |
356 |
|
arrondissement integer NOT NULL, |
357 |
|
libelle character varying(3) NOT NULL |
358 |
|
); |
359 |
|
|
360 |
|
ALTER TABLE ONLY arrondissement |
361 |
|
ADD CONSTRAINT arrondissement_pkey PRIMARY KEY (arrondissement); |
362 |
|
|
363 |
|
CREATE TABLE quartier ( |
364 |
|
quartier integer NOT NULL, |
365 |
|
arrondissement integer NOT NULL, |
366 |
|
code_impots character varying(3) NOT NULL, |
367 |
|
libelle character varying(40) NOT NULL |
368 |
|
); |
369 |
|
|
370 |
|
ALTER TABLE ONLY quartier |
371 |
|
ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier); |
372 |
|
ALTER TABLE ONLY quartier |
373 |
|
ADD CONSTRAINT quartier_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
374 |
|
|
375 |
|
CREATE TABLE lien_localisation_nature ( |
376 |
|
lien_localisation_nature integer NOT NULL, |
377 |
|
nature character varying(2), |
378 |
|
arrondissement integer, |
379 |
|
quartier integer , |
380 |
|
section varchar(2), |
381 |
|
instructeur integer NOT NULL |
382 |
|
); |
383 |
|
|
384 |
|
ALTER TABLE ONLY lien_localisation_nature |
385 |
|
ADD CONSTRAINT lien_localisation_nature_pkey PRIMARY KEY (lien_localisation_nature); |
386 |
|
ALTER TABLE ONLY lien_localisation_nature |
387 |
|
ADD CONSTRAINT lien_localisation_nature_nature_fkey FOREIGN KEY (nature) REFERENCES nature(nature); |
388 |
|
ALTER TABLE ONLY lien_localisation_nature |
389 |
|
ADD CONSTRAINT lien_localisation_nature_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
390 |
|
ALTER TABLE ONLY lien_localisation_nature |
391 |
|
ADD CONSTRAINT lien_localisation_nature_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier); |
392 |
|
ALTER TABLE ONLY lien_localisation_nature |
393 |
|
ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
394 |
|
|
395 |
|
-- Ajout des droits pour le retour des services |
396 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_encours', '2'); |
397 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_retour_service', '2'); |
398 |
|
|
399 |
|
-- Suppression des colonnes inutiles dans la table om_utilisateur |
400 |
|
ALTER TABLE om_utilisateur DROP instructeur; |
401 |
|
|
402 |
|
ALTER TABLE om_utilisateur DROP telephone; |
403 |
|
|
404 |
|
-- Ajout des droits sur lien_service_om_utilisateur |
405 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_om_utilisateur', '2'); |
406 |
|
-- Ajout des droits pour le retour des services |
407 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_passee', '2'); |
408 |
|
|
409 |
|
-- Ajout des droits sur lien_localisation_nature |
410 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_localisation_nature', '2'); |
411 |
|
|
412 |
|
-- Ajout du droit pour changer l'état (lu/non lu) d'une consultation |
413 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_modifier_lu', '2'); |
414 |
|
|
415 |
|
-- Changement de taille du champs parcelle de la table parcelle et terrain |
416 |
|
ALTER TABLE parcelle ALTER COLUMN parcelle TYPE character varying(20); |
417 |
|
ALTER TABLE terrain ALTER COLUMN parcelle TYPE character varying(20); |
418 |
|
|
419 |
|
|
420 |
|
-- |
421 |
|
-- Messages |
422 |
|
-- |
423 |
|
|
424 |
|
-- create sequence for the message ID generation |
425 |
|
CREATE SEQUENCE messages_seq |
426 |
|
START WITH 1 |
427 |
|
INCREMENT BY 1 |
428 |
|
NO MINVALUE |
429 |
|
NO MAXVALUE |
430 |
|
CACHE 1; |
431 |
|
|
432 |
|
-- Create table messages |
433 |
|
CREATE TABLE messages ( |
434 |
|
message integer PRIMARY KEY DEFAULT nextval('messages_seq'), |
435 |
|
dossier character varying(12), |
436 |
|
type character varying(60), |
437 |
|
emetteur character varying(40), |
438 |
|
date_emission DATE NOT NULL, |
439 |
|
enjeux_erp boolean default FALSE, |
440 |
|
enjeux_urba boolean default FALSE, |
441 |
|
lu boolean default FALSE, |
442 |
|
FOREIGN KEY ( dossier ) REFERENCES dossier ( dossier ) -- add this |
443 |
|
); |
444 |
|
ALTER SEQUENCE messages_seq OWNED BY messages.message; |
445 |
|
|
446 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'menu_suivi', '2'); |
447 |
|
|
448 |
|
-- Droit de l'ajout forcé d'un instructeur |
449 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'dossier_modifier_instructeur', '2'); |