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 ( |
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 |
193 |
ALTER TABLE dossier ADD COLUMN avis_decision integer; |
ALTER TABLE dossier ADD COLUMN avis_decision integer; |
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
UPDATE consultation SET avis_consultation=(select avis_consultation.avis_consultation from avis_consultation where avis=avis_consultation.avis_old); |
UPDATE consultation SET avis_consultation=(select avis_consultation.avis_consultation from avis_consultation where avis=avis_consultation.avis_old); |
200 |
|
|
201 |
-- |
-- |
228 |
ALTER TABLE avis_decision DROP COLUMN avis_old; |
ALTER TABLE avis_decision DROP COLUMN avis_old; |
229 |
ALTER TABLE avis_consultation DROP COLUMN avis_old; |
ALTER TABLE avis_consultation DROP COLUMN avis_old; |
230 |
DROP TABLE avis; |
DROP TABLE avis; |
231 |
|
DROP TABLE avis_consultation_tmp; |
|
-- |
|
|
-- Ajout des droits sur l'objet consultation_encours |
|
|
-- |
|
|
|
|
|
|
|
|
INSERT INTO om_widget VALUES (1, 1, 'Retours de consultations', '../scr/tab.php?obj=consultation_mes_retours', '<script type=''text/javascript''> |
|
|
$.ajax({ |
|
|
type: ''GET'', |
|
|
url:''../app/get_num_consult.php'', |
|
|
cache: false, |
|
|
success: function(html){ |
|
|
$(''#number_return'').append(html); |
|
|
} |
|
|
}); |
|
|
</script> |
|
|
<div id="number_return"></div>',2); |
|
232 |
|
|
233 |
-- |
-- |
234 |
-- Ajout des droits sur les nouvelles tables |
-- Ajout des droits sur les nouvelles tables |
239 |
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'); |
240 |
|
|
241 |
ALTER TABLE consultation ALTER service SET NOT NULL; |
ALTER TABLE consultation ALTER service SET NOT NULL; |
242 |
ALTER TABLE dossier ADD COLUMN enjeu boolean; |
ALTER TABLE dossier ADD COLUMN enjeu_erp boolean; |
243 |
|
ALTER TABLE dossier ADD COLUMN enjeu_urba boolean; |
244 |
|
|
245 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_mes_retours', 4); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_mes_retours', 4); |
246 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_tous_retours', 4); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_tous_retours', 4); |
247 |
|
|
258 |
CREATE TABLE direction ( |
CREATE TABLE direction ( |
259 |
direction integer NOT NULL, |
direction integer NOT NULL, |
260 |
code character varying(20) NOT NULL, |
code character varying(20) NOT NULL, |
261 |
libelle character varying(40) NOT NULL, |
libelle character varying(100) NOT NULL, |
262 |
description text, |
description text, |
263 |
chef character varying(30) NOT NULL, |
chef character varying(100) NOT NULL, |
264 |
|
om_validite_debut date, |
265 |
|
om_validite_fin date, |
266 |
PRIMARY KEY (direction) |
PRIMARY KEY (direction) |
267 |
); |
); |
268 |
|
|
269 |
INSERT INTO direction VALUES (nextval('direction_seq'::regclass),'ADS', 'Direction ADS', 'Direction des autorisations des droits du sol', 'Mme Dupont'); |
INSERT INTO direction VALUES (nextval('direction_seq'::regclass),'ADS', 'Direction ADS', 'Direction des autorisations des droits du sol', 'Mme Dupont', NULL, NULL); |
270 |
|
|
271 |
CREATE SEQUENCE division_seq |
CREATE SEQUENCE division_seq |
272 |
START WITH 1 |
START WITH 1 |
278 |
CREATE TABLE division ( |
CREATE TABLE division ( |
279 |
division integer NOT NULL, |
division integer NOT NULL, |
280 |
code character varying(20) NOT NULL, |
code character varying(20) NOT NULL, |
281 |
libelle character varying(40) NOT NULL, |
libelle character varying(100) NOT NULL, |
282 |
description text, |
description text, |
283 |
chef character varying(30) NOT NULL, |
chef character varying(100) NOT NULL, |
284 |
direction integer NOT NULL, |
direction integer NOT NULL, |
285 |
|
om_validite_debut date, |
286 |
|
om_validite_fin date, |
287 |
PRIMARY KEY (division), |
PRIMARY KEY (division), |
288 |
FOREIGN KEY ( direction ) REFERENCES direction ( direction ) |
FOREIGN KEY ( direction ) REFERENCES direction ( direction ) |
289 |
); |
); |
290 |
|
|
291 |
INSERT INTO division VALUES (nextval('division_seq'::regclass),'Defaut', 'Division par defaut', '', 'Mme Dupont',1); |
INSERT INTO division VALUES (nextval('division_seq'::regclass),'Defaut', 'Division par defaut', '', 'Mme Dupont',1, NULL, NULL); |
292 |
|
|
293 |
CREATE SEQUENCE instructeur_seq |
CREATE SEQUENCE instructeur_seq |
294 |
START WITH 1 |
START WITH 1 |
299 |
|
|
300 |
CREATE TABLE instructeur ( |
CREATE TABLE instructeur ( |
301 |
instructeur integer NOT NULL, |
instructeur integer NOT NULL, |
302 |
nom character varying(30) NOT NULL, |
nom character varying(100) NOT NULL, |
303 |
telephone character varying(14), |
telephone character varying(14), |
304 |
division integer NOT NULL, |
division integer NOT NULL, |
305 |
om_utilisateur integer, |
om_utilisateur integer, |
306 |
|
om_validite_debut date, |
307 |
|
om_validite_fin date, |
308 |
PRIMARY KEY ( instructeur ), |
PRIMARY KEY ( instructeur ), |
309 |
FOREIGN KEY ( division ) REFERENCES division ( division ), |
FOREIGN KEY ( division ) REFERENCES division ( division ), |
310 |
FOREIGN KEY ( om_utilisateur ) REFERENCES om_utilisateur ( om_utilisateur ) |
FOREIGN KEY ( om_utilisateur ) REFERENCES om_utilisateur ( om_utilisateur ) |
329 |
ALTER TABLE dossier ADD CONSTRAINT |
ALTER TABLE dossier ADD CONSTRAINT |
330 |
dossier_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
dossier_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
331 |
|
|
332 |
|
ALTER TABLE dossier ADD COLUMN division integer; |
333 |
|
ALTER TABLE dossier ADD CONSTRAINT |
334 |
|
dossier_division_fkey FOREIGN KEY (division) REFERENCES division(division); |
335 |
|
|
336 |
-- Ajout des parametres des liens dans la table om_parametre |
-- Ajout des parametres des liens dans la table om_parametre |
337 |
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'lien_interne_vdm', '',1); |
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'services_consultes_lien_interne', '',1); |
338 |
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'lien_externe', '',1); |
INSERT INTO om_parametre VALUES (nextval('om_parametre_seq'::regclass),'services_consultes_lien_externe', '',1); |
339 |
ALTER TABLE om_parametre ALTER COLUMN valeur TYPE character varying(150); |
ALTER TABLE om_parametre ALTER COLUMN valeur TYPE character varying(150); |
340 |
|
|
341 |
|
|
346 |
-- |
-- |
347 |
CREATE TABLE arrondissement ( |
CREATE TABLE arrondissement ( |
348 |
arrondissement integer NOT NULL, |
arrondissement integer NOT NULL, |
349 |
numero character varying(3) NOT NULL |
libelle character varying(3) NOT NULL |
350 |
); |
); |
351 |
|
|
352 |
ALTER TABLE ONLY arrondissement |
ALTER TABLE ONLY arrondissement |
353 |
ADD CONSTRAINT arrondissement_pkey PRIMARY KEY (arrondissement); |
ADD CONSTRAINT arrondissement_pkey PRIMARY KEY (arrondissement); |
354 |
|
|
355 |
|
CREATE SEQUENCE arrondissement_seq |
356 |
|
INCREMENT 1 |
357 |
|
MINVALUE 1 |
358 |
|
MAXVALUE 9223372036854775807 |
359 |
|
START 1 |
360 |
|
CACHE 1; |
361 |
|
|
362 |
CREATE TABLE quartier ( |
CREATE TABLE quartier ( |
363 |
quartier integer NOT NULL, |
quartier integer NOT NULL, |
364 |
|
arrondissement integer NOT NULL, |
365 |
code_impots character varying(3) NOT NULL, |
code_impots character varying(3) NOT NULL, |
366 |
libelle character varying(40) NOT NULL |
libelle character varying(40) NOT NULL |
367 |
); |
); |
368 |
|
|
369 |
ALTER TABLE ONLY quartier |
ALTER TABLE ONLY quartier |
370 |
ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier); |
ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier); |
371 |
|
ALTER TABLE ONLY quartier |
372 |
|
ADD CONSTRAINT quartier_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
373 |
|
|
374 |
|
CREATE SEQUENCE quartier_seq |
375 |
|
INCREMENT 1 |
376 |
|
MINVALUE 1 |
377 |
|
MAXVALUE 9223372036854775807 |
378 |
|
START 1 |
379 |
|
CACHE 1; |
380 |
|
|
381 |
CREATE TABLE lien_localisation_nature ( |
CREATE TABLE lien_localisation_nature ( |
382 |
lien_localisation_nature integer NOT NULL, |
lien_localisation_nature integer NOT NULL, |
383 |
nature character varying(2) NOT NULL, |
nature character varying(2), |
384 |
arrondissement integer NOT NULL, |
arrondissement integer, |
385 |
quartier integer NOT NULL, |
quartier integer , |
386 |
section varchar(10) NOT NULL default '*' |
section varchar(2), |
387 |
|
instructeur integer NOT NULL |
388 |
); |
); |
389 |
|
|
390 |
ALTER TABLE ONLY lien_localisation_nature |
ALTER TABLE ONLY lien_localisation_nature |
395 |
ADD CONSTRAINT lien_localisation_nature_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
ADD CONSTRAINT lien_localisation_nature_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
396 |
ALTER TABLE ONLY lien_localisation_nature |
ALTER TABLE ONLY lien_localisation_nature |
397 |
ADD CONSTRAINT lien_localisation_nature_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier); |
ADD CONSTRAINT lien_localisation_nature_quartier_fkey FOREIGN KEY (quartier) REFERENCES quartier(quartier); |
398 |
|
ALTER TABLE ONLY lien_localisation_nature |
399 |
|
ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
400 |
|
|
401 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2'); |
CREATE SEQUENCE lien_localisation_nature_seq |
402 |
|
INCREMENT 1 |
403 |
|
MINVALUE 1 |
404 |
|
MAXVALUE 9223372036854775807 |
405 |
|
START 1 |
406 |
|
CACHE 1; |
407 |
|
|
408 |
-- Ajout des droits pour le retour des services |
-- Ajout des droits pour le retour des services |
409 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_encours', '2'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_encours', '2'); |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_retour_service', '2'); |
|
410 |
|
|
411 |
-- Suppression des colonnes inutiles dans la table om_utilisateur |
-- Suppression des colonnes inutiles dans la table om_utilisateur |
412 |
ALTER TABLE om_utilisateur DROP instructeur; |
ALTER TABLE om_utilisateur DROP instructeur; |
416 |
-- Ajout des droits sur lien_service_om_utilisateur |
-- Ajout des droits sur lien_service_om_utilisateur |
417 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_om_utilisateur', '2'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_service_om_utilisateur', '2'); |
418 |
-- Ajout des droits pour le retour des services |
-- Ajout des droits pour le retour des services |
419 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_passee', '2'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_passee', '2'); |
420 |
|
|
421 |
|
-- Ajout des droits sur lien_localisation_nature |
422 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_localisation_nature', '2'); |
423 |
|
|
424 |
|
-- Ajout du droit pour changer l'état (lu/non lu) d'une consultation |
425 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_modifier_lu', '2'); |
426 |
|
|
427 |
|
-- Changement de taille du champs parcelle de la table parcelle et terrain |
428 |
|
ALTER TABLE parcelle ALTER COLUMN parcelle TYPE character varying(20); |
429 |
|
ALTER TABLE terrain ALTER COLUMN parcelle TYPE character varying(20); |
430 |
|
|
431 |
|
|
432 |
|
-- |
433 |
|
-- Messages |
434 |
|
-- |
435 |
|
|
436 |
|
-- create sequence for the message ID generation |
437 |
|
CREATE SEQUENCE messages_seq |
438 |
|
START WITH 1 |
439 |
|
INCREMENT BY 1 |
440 |
|
NO MINVALUE |
441 |
|
NO MAXVALUE |
442 |
|
CACHE 1; |
443 |
|
|
444 |
|
-- Create table messages |
445 |
|
CREATE TABLE messages ( |
446 |
|
message integer PRIMARY KEY DEFAULT nextval('messages_seq'), |
447 |
|
dossier character varying(12), |
448 |
|
type character varying(60), |
449 |
|
emetteur character varying(40), |
450 |
|
date_emission DATE NOT NULL, |
451 |
|
lu boolean default FALSE, |
452 |
|
FOREIGN KEY ( dossier ) REFERENCES dossier ( dossier ) -- add this |
453 |
|
); |
454 |
|
ALTER SEQUENCE messages_seq OWNED BY messages.message; |
455 |
|
|
456 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'menu_suivi', '2'); |
457 |
|
|
458 |
|
-- Droit de l'ajout forcé d'un instructeur |
459 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'dossier_modifier_instructeur', '2'); |
460 |
|
|
461 |
|
-- Module 1 |
462 |
|
CREATE TABLE dossier_autorisation_type ( |
463 |
|
dossier_autorisation_type integer, |
464 |
|
code character varying(20), |
465 |
|
libelle character varying(100), |
466 |
|
description text, |
467 |
|
confidentiel boolean default FALSE |
468 |
|
); |
469 |
|
|
470 |
|
ALTER TABLE ONLY dossier_autorisation_type |
471 |
|
ADD CONSTRAINT dossier_autorisation_type_pkey PRIMARY KEY (dossier_autorisation_type); |
472 |
|
|
473 |
|
CREATE SEQUENCE dossier_autorisation_type_seq |
474 |
|
INCREMENT 1 |
475 |
|
MINVALUE 1 |
476 |
|
MAXVALUE 9223372036854775807 |
477 |
|
START 1 |
478 |
|
CACHE 1; |
479 |
|
|
480 |
|
-- |
481 |
|
|
482 |
|
CREATE TABLE dossier_autorisation_type_detaille ( |
483 |
|
dossier_autorisation_type_detaille integer, |
484 |
|
code character varying(20), |
485 |
|
libelle character varying(100), |
486 |
|
description text, |
487 |
|
dossier_autorisation_type integer |
488 |
|
); |
489 |
|
|
490 |
|
ALTER TABLE ONLY dossier_autorisation_type_detaille |
491 |
|
ADD CONSTRAINT dossier_autorisation_type_detaille_pkey PRIMARY KEY (dossier_autorisation_type_detaille); |
492 |
|
ALTER TABLE ONLY dossier_autorisation_type_detaille |
493 |
|
ADD CONSTRAINT dossier_autorisation_type_detaille_dossier_autorisation_type_fkey FOREIGN KEY (dossier_autorisation_type) REFERENCES dossier_autorisation_type(dossier_autorisation_type); |
494 |
|
|
495 |
|
CREATE SEQUENCE dossier_autorisation_type_detaille_seq |
496 |
|
INCREMENT 1 |
497 |
|
MINVALUE 1 |
498 |
|
MAXVALUE 9223372036854775807 |
499 |
|
START 1 |
500 |
|
CACHE 1; |
501 |
|
|
502 |
|
-- |
503 |
|
|
504 |
|
CREATE TABLE dossier_instruction_type ( |
505 |
|
dossier_instruction_type integer, |
506 |
|
code character varying(20), |
507 |
|
libelle character varying(100), |
508 |
|
description text, |
509 |
|
dossier_autorisation_type_detaille integer, |
510 |
|
suffixe boolean default FALSE |
511 |
|
); |
512 |
|
|
513 |
|
ALTER TABLE ONLY dossier_instruction_type |
514 |
|
ADD CONSTRAINT dossier_instruction_type_pkey PRIMARY KEY (dossier_instruction_type); |
515 |
|
ALTER TABLE ONLY dossier_instruction_type |
516 |
|
ADD CONSTRAINT dossier_instruction_type_dossier_autorisation_type_detaille_fkey FOREIGN KEY (dossier_autorisation_type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille); |
517 |
|
|
518 |
|
CREATE SEQUENCE dossier_instruction_type_seq |
519 |
|
INCREMENT 1 |
520 |
|
MINVALUE 1 |
521 |
|
MAXVALUE 9223372036854775807 |
522 |
|
START 1 |
523 |
|
CACHE 1; |
524 |
|
|
525 |
|
-- |
526 |
|
|
527 |
|
CREATE TABLE demande_genre ( |
528 |
|
demande_genre integer, |
529 |
|
code character varying(20), |
530 |
|
libelle character varying(100), |
531 |
|
description text |
532 |
|
); |
533 |
|
|
534 |
|
ALTER TABLE ONLY demande_genre |
535 |
|
ADD CONSTRAINT demande_genre_pkey PRIMARY KEY (demande_genre); |
536 |
|
|
537 |
|
CREATE SEQUENCE demande_genre_seq |
538 |
|
INCREMENT 1 |
539 |
|
MINVALUE 1 |
540 |
|
MAXVALUE 9223372036854775807 |
541 |
|
START 1 |
542 |
|
CACHE 1; |
543 |
|
|
544 |
|
-- |
545 |
|
|
546 |
|
CREATE TABLE groupe ( |
547 |
|
groupe integer, |
548 |
|
code character varying(20), |
549 |
|
libelle character varying(100), |
550 |
|
description text, |
551 |
|
demande_genre integer |
552 |
|
); |
553 |
|
|
554 |
|
ALTER TABLE ONLY groupe |
555 |
|
ADD CONSTRAINT groupe_pkey PRIMARY KEY (groupe); |
556 |
|
ALTER TABLE ONLY groupe |
557 |
|
ADD CONSTRAINT groupe_demande_genre_fkey FOREIGN KEY (demande_genre) REFERENCES demande_genre(demande_genre); |
558 |
|
|
559 |
|
CREATE SEQUENCE groupe_seq |
560 |
|
INCREMENT 1 |
561 |
|
MINVALUE 1 |
562 |
|
MAXVALUE 9223372036854775807 |
563 |
|
START 1 |
564 |
|
CACHE 1; |
565 |
|
|
566 |
|
-- Ajout de clé étrangère à la table dossier_autorisation_type |
567 |
|
ALTER TABLE dossier_autorisation_type ADD COLUMN groupe integer; |
568 |
|
ALTER TABLE ONLY dossier_autorisation_type |
569 |
|
ADD CONSTRAINT dossier_autorisation_type_groupe_fkey FOREIGN KEY (groupe) REFERENCES groupe(groupe); |
570 |
|
|
571 |
|
--Demande nature |
572 |
|
|
573 |
|
CREATE TABLE demande_nature ( |
574 |
|
demande_nature integer, |
575 |
|
code character varying(20), |
576 |
|
libelle character varying(100), |
577 |
|
description text |
578 |
|
); |
579 |
|
|
580 |
|
ALTER TABLE ONLY demande_nature |
581 |
|
ADD CONSTRAINT demande_nature_pkey PRIMARY KEY (demande_nature); |
582 |
|
|
583 |
|
CREATE SEQUENCE demande_nature_seq |
584 |
|
INCREMENT 1 |
585 |
|
MINVALUE 1 |
586 |
|
MAXVALUE 9223372036854775807 |
587 |
|
START 1 |
588 |
|
CACHE 1; |
589 |
|
|
590 |
|
--Demande type |
591 |
|
|
592 |
|
CREATE TABLE demande_type ( |
593 |
|
demande_type integer, |
594 |
|
code character varying(20), |
595 |
|
libelle character varying(100), |
596 |
|
description text, |
597 |
|
demande_nature integer, |
598 |
|
groupe integer, |
599 |
|
dossier_instruction_type integer, |
600 |
|
dossier_autorisation_type_detaille integer, |
601 |
|
contraintes character varying(20), |
602 |
|
etats_dossier_autorisation_autorises character varying(100), |
603 |
|
qualification boolean, |
604 |
|
evenement integer |
605 |
|
); |
606 |
|
|
607 |
|
ALTER TABLE ONLY demande_type |
608 |
|
ADD CONSTRAINT demande_type_pkey PRIMARY KEY (demande_type); |
609 |
|
ALTER TABLE ONLY demande_type |
610 |
|
ADD CONSTRAINT demande_type_demande_nature_fkey FOREIGN KEY (demande_nature) REFERENCES demande_nature(demande_nature); |
611 |
|
ALTER TABLE ONLY demande_type |
612 |
|
ADD CONSTRAINT demande_type_groupe_fkey FOREIGN KEY (groupe) REFERENCES groupe(groupe); |
613 |
|
ALTER TABLE ONLY demande_type |
614 |
|
ADD CONSTRAINT demande_type_dossier_instruction_type_fkey FOREIGN KEY (dossier_instruction_type) REFERENCES dossier_instruction_type(dossier_instruction_type); |
615 |
|
ALTER TABLE ONLY demande_type |
616 |
|
ADD CONSTRAINT demande_type_dossier_autorisation_type_detaille_fkey FOREIGN KEY (dossier_autorisation_type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille); |
617 |
|
ALTER TABLE ONLY demande_type |
618 |
|
ADD CONSTRAINT demande_type_evenement_fkey FOREIGN KEY (evenement) REFERENCES evenement(evenement); |
619 |
|
|
620 |
|
CREATE SEQUENCE demande_type_seq |
621 |
|
INCREMENT 1 |
622 |
|
MINVALUE 1 |
623 |
|
MAXVALUE 9223372036854775807 |
624 |
|
START 1 |
625 |
|
CACHE 1; |
626 |
|
|
627 |
|
-- |
628 |
|
|
629 |
|
CREATE TABLE lien_evenement_dossier_autorisation_type ( |
630 |
|
lien_evenement_dossier_autorisation_type integer, |
631 |
|
evenement integer, |
632 |
|
dossier_autorisation_type integer |
633 |
|
); |
634 |
|
|
635 |
|
ALTER TABLE ONLY lien_evenement_dossier_autorisation_type |
636 |
|
ADD CONSTRAINT lien_evenement_dossier_autorisation_type_pkey PRIMARY KEY (lien_evenement_dossier_autorisation_type); |
637 |
|
ALTER TABLE ONLY lien_evenement_dossier_autorisation_type |
638 |
|
ADD CONSTRAINT lien_evenement_dossier_autorisation_type_evenement_fkey FOREIGN KEY (evenement) REFERENCES evenement(evenement); |
639 |
|
ALTER TABLE ONLY lien_evenement_dossier_autorisation_type |
640 |
|
ADD CONSTRAINT lien_evenement_dossier_autorisation_type_dossier_autorisation_type_fkey FOREIGN KEY (dossier_autorisation_type) REFERENCES dossier_autorisation_type(dossier_autorisation_type); |
641 |
|
|
642 |
|
CREATE SEQUENCE lien_evenement_dossier_autorisation_type_seq |
643 |
|
INCREMENT 1 |
644 |
|
MINVALUE 1 |
645 |
|
MAXVALUE 9223372036854775807 |
646 |
|
START 1 |
647 |
|
CACHE 1; |
648 |
|
|
649 |
|
-- |
650 |
|
|
651 |
|
CREATE TABLE autorite_competente ( |
652 |
|
autorite_competente integer, |
653 |
|
code character varying(20), |
654 |
|
libelle character varying(100), |
655 |
|
description text |
656 |
|
); |
657 |
|
|
658 |
|
ALTER TABLE ONLY autorite_competente |
659 |
|
ADD CONSTRAINT autorite_competente_pkey PRIMARY KEY (autorite_competente); |
660 |
|
|
661 |
|
CREATE SEQUENCE autorite_competente_seq |
662 |
|
INCREMENT 1 |
663 |
|
MINVALUE 1 |
664 |
|
MAXVALUE 9223372036854775807 |
665 |
|
START 1 |
666 |
|
CACHE 1; |
667 |
|
|
668 |
|
-- Ajout de clé étrangère à la table dossier_autorisation_type |
669 |
|
ALTER TABLE dossier ADD COLUMN autorite_competente integer; |
670 |
|
ALTER TABLE ONLY dossier |
671 |
|
ADD CONSTRAINT dossier_autorite_competente_fkey FOREIGN KEY (autorite_competente) REFERENCES autorite_competente(autorite_competente); |
672 |
|
|
673 |
|
-- Donnees des tables |
674 |
|
INSERT INTO dossier_autorisation_type(dossier_autorisation_type, code, libelle) SELECT nextval('dossier_autorisation_type_seq'), nature, libelle FROM nature; |
675 |
|
INSERT INTO dossier_autorisation_type_detaille(dossier_autorisation_type_detaille, code, libelle) SELECT nextval('dossier_autorisation_type_seq'), nature, libelle FROM nature; |
676 |
|
|
677 |
|
INSERT INTO demande_genre VALUES (nextval('demande_genre_seq'), 'URBA', 'Pôle Urbanisme', 'Responsabilité de la DDU'); |
678 |
|
INSERT INTO demande_genre VALUES (nextval('demande_genre_seq'), 'ERP', 'Pôle ERP', 'Responsabilité de la DGUP'); |
679 |
|
|
680 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'ADS', 'Autorisation ADS', '',1); |
681 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'CTX', 'Contentieux dans le domaine urbanisme', '',1); |
682 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'CU', 'Changement d''usage', '',1); |
683 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'RU', 'Renseignement d''urbanisme', '',1); |
684 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'ERP', 'ERP', '',2); |
685 |
|
|
686 |
|
-- Table dossier_autorisation |
687 |
|
|
688 |
|
CREATE TABLE dossier_autorisation ( |
689 |
|
dossier_autorisation integer, |
690 |
|
nature character varying(2), |
691 |
|
dossier_autorisation_type_detaille integer, |
692 |
|
exercice integer, |
693 |
|
insee integer |
694 |
|
); |
695 |
|
|
696 |
|
ALTER TABLE ONLY dossier_autorisation |
697 |
|
ADD CONSTRAINT dossier_autorisation_pkey PRIMARY KEY (dossier_autorisation); |
698 |
|
ALTER TABLE ONLY dossier_autorisation |
699 |
|
ADD CONSTRAINT dossier_autorisation_nature_fkey FOREIGN KEY (nature) REFERENCES nature(nature); |
700 |
|
ALTER TABLE ONLY dossier_autorisation |
701 |
|
ADD CONSTRAINT dossier_autorisation_dossier_autorisation_type_detaille_fkey FOREIGN KEY (dossier_autorisation_type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille); |
702 |
|
|
703 |
|
CREATE SEQUENCE dossier_autorisation_seq |
704 |
|
INCREMENT 1 |
705 |
|
MINVALUE 1 |
706 |
|
MAXVALUE 9223372036854775807 |
707 |
|
START 1 |
708 |
|
CACHE 1; |
709 |
|
|
710 |
|
-- Table Demande |
711 |
|
|
712 |
|
CREATE TABLE demande ( |
713 |
|
demande integer, |
714 |
|
dossier_autorisation_type_detaille integer, |
715 |
|
demande_type integer, |
716 |
|
dossier_instruction character varying(12), |
717 |
|
dossier_autorisation integer, |
718 |
|
date_demande date, |
719 |
|
terrain_references_cadastrales character varying(100), |
720 |
|
terrain_adresse_voie_numero integer, |
721 |
|
complement character varying(30), |
722 |
|
terrain_adresse_lieu_dit character varying(30), |
723 |
|
terrain_adresse_localite character varying(30), |
724 |
|
terrain_adresse_code_postal character varying(5), |
725 |
|
terrain_adresse_bp character varying(15), |
726 |
|
terrain_adresse_cedex character varying(15), |
727 |
|
terrain_superficie double precision, |
728 |
|
nombre_lots integer |
729 |
|
); |
730 |
|
|
731 |
|
ALTER TABLE ONLY demande |
732 |
|
ADD CONSTRAINT demande_pkey PRIMARY KEY (demande); |
733 |
|
ALTER TABLE ONLY demande |
734 |
|
ADD CONSTRAINT demande_dossier_autorisation_type_detaille_fkey FOREIGN KEY (dossier_autorisation_type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille); |
735 |
|
ALTER TABLE ONLY demande |
736 |
|
ADD CONSTRAINT demande_demande_type_fkey FOREIGN KEY (demande_type) REFERENCES demande_type(demande_type); |
737 |
|
ALTER TABLE ONLY demande |
738 |
|
ADD CONSTRAINT demande_dossier_instruction_fkey FOREIGN KEY (dossier_instruction) REFERENCES dossier(dossier); |
739 |
|
ALTER TABLE ONLY demande |
740 |
|
ADD CONSTRAINT demande_dossier_autorisation_fkey FOREIGN KEY (dossier_autorisation) REFERENCES dossier_autorisation(dossier_autorisation); |
741 |
|
|
742 |
|
CREATE SEQUENCE demande_seq |
743 |
|
INCREMENT 1 |
744 |
|
MINVALUE 1 |
745 |
|
MAXVALUE 9223372036854775807 |
746 |
|
START 1 |
747 |
|
CACHE 1; |
748 |
|
|
749 |
|
-- Table Demandeur |
750 |
|
|
751 |
|
CREATE TABLE demandeur ( |
752 |
|
demandeur integer, |
753 |
|
type_demandeur character varying(40), |
754 |
|
particulier_civilite character varying(10), |
755 |
|
particulier_nom character varying(40), |
756 |
|
particulier_prenom character varying(40), |
757 |
|
particulier_date_naissance date, |
758 |
|
particulier_commune_naissance character varying(30), |
759 |
|
particulier_departement_naissance character varying(80), |
760 |
|
personne_morale_denomination character varying(15), |
761 |
|
personne_morale_raison_sociale character varying(15), |
762 |
|
personne_morale_siret character varying(15), |
763 |
|
personne_morale_categorie_juridique character varying(15), |
764 |
|
personne_morale_civilite character varying(10), |
765 |
|
personne_morale_nom character varying(40), |
766 |
|
personne_morale_prenom character varying(40), |
767 |
|
numero character varying(5), |
768 |
|
voie character varying(40), |
769 |
|
complement character varying(39), |
770 |
|
lieu_dit character varying(39), |
771 |
|
localite character varying(30), |
772 |
|
code_postal character varying(5), |
773 |
|
bp character varying(5), |
774 |
|
cedex character varying(5), |
775 |
|
pays character varying(40), |
776 |
|
division_territoriale character varying(40), |
777 |
|
telephone_fixe character varying(14), |
778 |
|
telephone_mobile character varying(14), |
779 |
|
indicatif character varying(5), |
780 |
|
courriel character varying(40), |
781 |
|
notification boolean, |
782 |
|
frequent boolean |
783 |
|
); |
784 |
|
|
785 |
|
ALTER TABLE ONLY demandeur |
786 |
|
ADD CONSTRAINT demandeur_pkey PRIMARY KEY (demandeur); |
787 |
|
ALTER TABLE ONLY demandeur |
788 |
|
ADD CONSTRAINT demandeur_particulier_civilite_fkey FOREIGN KEY (particulier_civilite) REFERENCES civilite(civilite); |
789 |
|
ALTER TABLE ONLY demandeur |
790 |
|
ADD CONSTRAINT demandeur_personne_morale_civilite_fkey FOREIGN KEY (personne_morale_civilite) REFERENCES civilite(civilite); |
791 |
|
|
792 |
|
CREATE SEQUENCE demandeur_seq |
793 |
|
INCREMENT 1 |
794 |
|
MINVALUE 1 |
795 |
|
MAXVALUE 9223372036854775807 |
796 |
|
START 1 |
797 |
|
CACHE 1; |
798 |
|
|
799 |
|
-- Table Lien demande demandeur |
800 |
|
|
801 |
|
CREATE TABLE lien_demande_demandeur ( |
802 |
|
lien_demande_demandeur integer, |
803 |
|
demande integer, |
804 |
|
demandeur integer |
805 |
|
); |
806 |
|
|
807 |
|
ALTER TABLE ONLY lien_demande_demandeur |
808 |
|
ADD CONSTRAINT lien_demande_demandeur_pkey PRIMARY KEY (lien_demande_demandeur); |
809 |
|
ALTER TABLE ONLY lien_demande_demandeur |
810 |
|
ADD CONSTRAINT lien_demande_demandeur_demande_fkey FOREIGN KEY (demande) REFERENCES demande(demande); |
811 |
|
ALTER TABLE ONLY lien_demande_demandeur |
812 |
|
ADD CONSTRAINT lien_demande_demandeur_demandeur_fkey FOREIGN KEY (demandeur) REFERENCES demandeur(demandeur); |
813 |
|
|
814 |
|
CREATE SEQUENCE lien_demande_demandeur_seq |
815 |
|
INCREMENT 1 |
816 |
|
MINVALUE 1 |
817 |
|
MAXVALUE 9223372036854775807 |
818 |
|
START 1 |
819 |
|
CACHE 1; |
820 |
|
|
821 |
|
-- Table lot |
822 |
|
|
823 |
|
CREATE TABLE lot ( |
824 |
|
lot integer, |
825 |
|
dossier_instruction character varying(12) |
826 |
|
); |
827 |
|
|
828 |
|
ALTER TABLE ONLY lot |
829 |
|
ADD CONSTRAINT lot_pkey PRIMARY KEY (lot); |
830 |
|
ALTER TABLE ONLY lot |
831 |
|
ADD CONSTRAINT lot_dossier_instruction_fkey FOREIGN KEY (dossier_instruction) REFERENCES dossier(dossier); |
832 |
|
|
833 |
|
CREATE SEQUENCE lot_seq |
834 |
|
INCREMENT 1 |
835 |
|
MINVALUE 1 |
836 |
|
MAXVALUE 9223372036854775807 |
837 |
|
START 1 |
838 |
|
CACHE 1; |
839 |
|
|
840 |
|
-- Table lien_lot_demandeur |
841 |
|
|
842 |
|
CREATE TABLE lien_lot_demandeur ( |
843 |
|
lien_lot_demandeur integer, |
844 |
|
lot integer, |
845 |
|
demandeur integer |
846 |
|
); |
847 |
|
|
848 |
|
ALTER TABLE ONLY lien_lot_demandeur |
849 |
|
ADD CONSTRAINT lien_lot_demandeur_pkey PRIMARY KEY (lien_lot_demandeur); |
850 |
|
ALTER TABLE ONLY lien_lot_demandeur |
851 |
|
ADD CONSTRAINT lien_lot_demandeur_lot_fkey FOREIGN KEY (lot) REFERENCES lot(lot); |
852 |
|
ALTER TABLE ONLY lien_lot_demandeur |
853 |
|
ADD CONSTRAINT lien_lot_demandeur_demandeur_fkey FOREIGN KEY (demandeur) REFERENCES demandeur(demandeur); |
854 |
|
|
855 |
|
CREATE SEQUENCE lien_lot_demandeur_seq |
856 |
|
INCREMENT 1 |
857 |
|
MINVALUE 1 |
858 |
|
MAXVALUE 9223372036854775807 |
859 |
|
START 1 |
860 |
|
CACHE 1; |
861 |
|
|
862 |
|
|
863 |
|
--- |
864 |
|
--- Nouvelle gestion des tableaux de bord |
865 |
|
--- |
866 |
|
|
867 |
|
CREATE TABLE om_dashboard ( |
868 |
|
om_dashboard integer NOT NULL, |
869 |
|
om_profil integer NOT NULL, |
870 |
|
bloc character varying(10) NOT NULL, |
871 |
|
position integer, |
872 |
|
om_widget integer NOT NULL |
873 |
|
); |
874 |
|
|
875 |
|
ALTER TABLE ONLY om_dashboard |
876 |
|
ADD CONSTRAINT om_dashboard_pkey PRIMARY KEY (om_dashboard); |
877 |
|
ALTER TABLE ONLY om_dashboard |
878 |
|
ADD CONSTRAINT om_dashboard_om_profil_fkey FOREIGN KEY (om_profil) REFERENCES om_profil(om_profil); |
879 |
|
ALTER TABLE ONLY om_dashboard |
880 |
|
ADD CONSTRAINT om_dashboard_om_widget_fkey FOREIGN KEY (om_widget) REFERENCES om_widget(om_widget); |
881 |
|
|
882 |
|
CREATE SEQUENCE om_dashboard_seq |
883 |
|
START WITH 1 |
884 |
|
INCREMENT BY 1 |
885 |
|
NO MINVALUE |
886 |
|
NO MAXVALUE |
887 |
|
CACHE 1; |
888 |
|
|
889 |
|
SELECT pg_catalog.setval('om_dashboard_seq', 1, false); |
890 |
|
|
891 |
|
ALTER TABLE om_widget |
892 |
|
DROP CONSTRAINT om_widget_om_profil_fkey; |
893 |
|
|
894 |
|
ALTER TABlE om_widget DROP COLUMN om_profil; |
895 |
|
|
896 |
|
ALTER TABLE om_widget ADD COLUMN "type" character varying(40) NOT NULL DEFAULT 'web'::character varying; |
897 |
|
ALTER TABLE om_widget ALTER COLUMN "lien" SET DEFAULT ''::character varying; |
898 |
|
ALTER TABLE om_widget ALTER COLUMN "texte" SET DEFAULT ''::text; |
899 |
|
|
900 |
|
|