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; |
232 |
|
|
233 |
-- |
-- |
234 |
-- Ajout des droits sur l'objet consultation_encours |
-- Ajout des droits sur l'objet consultation_encours |
256 |
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'); |
257 |
|
|
258 |
ALTER TABLE consultation ALTER service SET NOT NULL; |
ALTER TABLE consultation ALTER service SET NOT NULL; |
259 |
ALTER TABLE dossier ADD COLUMN enjeu boolean; |
ALTER TABLE dossier ADD COLUMN enjeu_erp boolean; |
260 |
|
ALTER TABLE dossier ADD COLUMN enjeu_urba boolean; |
261 |
|
|
262 |
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); |
263 |
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); |
264 |
|
|
275 |
CREATE TABLE direction ( |
CREATE TABLE direction ( |
276 |
direction integer NOT NULL, |
direction integer NOT NULL, |
277 |
code character varying(20) NOT NULL, |
code character varying(20) NOT NULL, |
278 |
libelle character varying(40) NOT NULL, |
libelle character varying(100) NOT NULL, |
279 |
description text, |
description text, |
280 |
chef character varying(30) NOT NULL, |
chef character varying(100) NOT NULL, |
281 |
|
om_validite_debut date, |
282 |
|
om_validite_fin date, |
283 |
PRIMARY KEY (direction) |
PRIMARY KEY (direction) |
284 |
); |
); |
285 |
|
|
286 |
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); |
287 |
|
|
288 |
CREATE SEQUENCE division_seq |
CREATE SEQUENCE division_seq |
289 |
START WITH 1 |
START WITH 1 |
295 |
CREATE TABLE division ( |
CREATE TABLE division ( |
296 |
division integer NOT NULL, |
division integer NOT NULL, |
297 |
code character varying(20) NOT NULL, |
code character varying(20) NOT NULL, |
298 |
libelle character varying(40) NOT NULL, |
libelle character varying(100) NOT NULL, |
299 |
description text, |
description text, |
300 |
chef character varying(30) NOT NULL, |
chef character varying(100) NOT NULL, |
301 |
direction integer NOT NULL, |
direction integer NOT NULL, |
302 |
|
om_validite_debut date, |
303 |
|
om_validite_fin date, |
304 |
PRIMARY KEY (division), |
PRIMARY KEY (division), |
305 |
FOREIGN KEY ( direction ) REFERENCES direction ( direction ) |
FOREIGN KEY ( direction ) REFERENCES direction ( direction ) |
306 |
); |
); |
307 |
|
|
308 |
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); |
309 |
|
|
310 |
CREATE SEQUENCE instructeur_seq |
CREATE SEQUENCE instructeur_seq |
311 |
START WITH 1 |
START WITH 1 |
316 |
|
|
317 |
CREATE TABLE instructeur ( |
CREATE TABLE instructeur ( |
318 |
instructeur integer NOT NULL, |
instructeur integer NOT NULL, |
319 |
nom character varying(30) NOT NULL, |
nom character varying(100) NOT NULL, |
320 |
telephone character varying(14), |
telephone character varying(14), |
321 |
division integer NOT NULL, |
division integer NOT NULL, |
322 |
om_utilisateur integer, |
om_utilisateur integer, |
323 |
|
om_validite_debut date, |
324 |
|
om_validite_fin date, |
325 |
PRIMARY KEY ( instructeur ), |
PRIMARY KEY ( instructeur ), |
326 |
FOREIGN KEY ( division ) REFERENCES division ( division ), |
FOREIGN KEY ( division ) REFERENCES division ( division ), |
327 |
FOREIGN KEY ( om_utilisateur ) REFERENCES om_utilisateur ( om_utilisateur ) |
FOREIGN KEY ( om_utilisateur ) REFERENCES om_utilisateur ( om_utilisateur ) |
359 |
-- |
-- |
360 |
CREATE TABLE arrondissement ( |
CREATE TABLE arrondissement ( |
361 |
arrondissement integer NOT NULL, |
arrondissement integer NOT NULL, |
362 |
numero character varying(3) NOT NULL |
libelle character varying(3) NOT NULL |
363 |
); |
); |
364 |
|
|
365 |
ALTER TABLE ONLY arrondissement |
ALTER TABLE ONLY arrondissement |
366 |
ADD CONSTRAINT arrondissement_pkey PRIMARY KEY (arrondissement); |
ADD CONSTRAINT arrondissement_pkey PRIMARY KEY (arrondissement); |
367 |
|
|
368 |
|
CREATE SEQUENCE arrondissement_seq |
369 |
|
INCREMENT 1 |
370 |
|
MINVALUE 1 |
371 |
|
MAXVALUE 9223372036854775807 |
372 |
|
START 1 |
373 |
|
CACHE 1; |
374 |
|
|
375 |
CREATE TABLE quartier ( |
CREATE TABLE quartier ( |
376 |
quartier integer NOT NULL, |
quartier integer NOT NULL, |
377 |
|
arrondissement integer NOT NULL, |
378 |
code_impots character varying(3) NOT NULL, |
code_impots character varying(3) NOT NULL, |
379 |
libelle character varying(40) NOT NULL |
libelle character varying(40) NOT NULL |
380 |
); |
); |
381 |
|
|
382 |
ALTER TABLE ONLY quartier |
ALTER TABLE ONLY quartier |
383 |
ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier); |
ADD CONSTRAINT quartier_pkey PRIMARY KEY (quartier); |
384 |
|
ALTER TABLE ONLY quartier |
385 |
|
ADD CONSTRAINT quartier_arrondissement_fkey FOREIGN KEY (arrondissement) REFERENCES arrondissement(arrondissement); |
386 |
|
|
387 |
|
CREATE SEQUENCE quartier_seq |
388 |
|
INCREMENT 1 |
389 |
|
MINVALUE 1 |
390 |
|
MAXVALUE 9223372036854775807 |
391 |
|
START 1 |
392 |
|
CACHE 1; |
393 |
|
|
394 |
CREATE TABLE lien_localisation_nature ( |
CREATE TABLE lien_localisation_nature ( |
395 |
lien_localisation_nature integer NOT NULL, |
lien_localisation_nature integer NOT NULL, |
396 |
nature character varying(2) NOT NULL, |
nature character varying(2), |
397 |
arrondissement integer NOT NULL, |
arrondissement integer, |
398 |
quartier integer NOT NULL, |
quartier integer , |
399 |
section varchar(10) NOT NULL default '*' |
section varchar(2), |
400 |
|
instructeur integer NOT NULL |
401 |
); |
); |
402 |
|
|
403 |
ALTER TABLE ONLY lien_localisation_nature |
ALTER TABLE ONLY lien_localisation_nature |
408 |
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); |
409 |
ALTER TABLE ONLY lien_localisation_nature |
ALTER TABLE ONLY lien_localisation_nature |
410 |
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); |
411 |
|
ALTER TABLE ONLY lien_localisation_nature |
412 |
|
ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur); |
413 |
|
|
414 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'avis_code_barre', '2'); |
CREATE SEQUENCE lien_localisation_nature_seq |
415 |
|
INCREMENT 1 |
416 |
|
MINVALUE 1 |
417 |
|
MAXVALUE 9223372036854775807 |
418 |
|
START 1 |
419 |
|
CACHE 1; |
420 |
|
|
421 |
-- Ajout des droits pour le retour des services |
-- Ajout des droits pour le retour des services |
422 |
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'); |
423 |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_retour_service', '2'); |
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_retour_service', '2'); |
424 |
|
|
425 |
-- Suppression des colonnes inutiles dans la table om_utilisateur |
-- Suppression des colonnes inutiles dans la table om_utilisateur |
430 |
-- Ajout des droits sur lien_service_om_utilisateur |
-- Ajout des droits sur lien_service_om_utilisateur |
431 |
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'); |
432 |
-- Ajout des droits pour le retour des services |
-- Ajout des droits pour le retour des services |
433 |
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'); |
434 |
|
|
435 |
|
-- Ajout des droits sur lien_localisation_nature |
436 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'lien_localisation_nature', '2'); |
437 |
|
|
438 |
|
-- Ajout du droit pour changer l'état (lu/non lu) d'une consultation |
439 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'consultation_modifier_lu', '2'); |
440 |
|
|
441 |
|
-- Changement de taille du champs parcelle de la table parcelle et terrain |
442 |
|
ALTER TABLE parcelle ALTER COLUMN parcelle TYPE character varying(20); |
443 |
|
ALTER TABLE terrain ALTER COLUMN parcelle TYPE character varying(20); |
444 |
|
|
445 |
|
|
446 |
|
-- |
447 |
|
-- Messages |
448 |
|
-- |
449 |
|
|
450 |
|
-- create sequence for the message ID generation |
451 |
|
CREATE SEQUENCE messages_seq |
452 |
|
START WITH 1 |
453 |
|
INCREMENT BY 1 |
454 |
|
NO MINVALUE |
455 |
|
NO MAXVALUE |
456 |
|
CACHE 1; |
457 |
|
|
458 |
|
-- Create table messages |
459 |
|
CREATE TABLE messages ( |
460 |
|
message integer PRIMARY KEY DEFAULT nextval('messages_seq'), |
461 |
|
dossier character varying(12), |
462 |
|
type character varying(60), |
463 |
|
emetteur character varying(40), |
464 |
|
date_emission DATE NOT NULL, |
465 |
|
lu boolean default FALSE, |
466 |
|
FOREIGN KEY ( dossier ) REFERENCES dossier ( dossier ) -- add this |
467 |
|
); |
468 |
|
ALTER SEQUENCE messages_seq OWNED BY messages.message; |
469 |
|
|
470 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'menu_suivi', '2'); |
471 |
|
|
472 |
|
-- Droit de l'ajout forcé d'un instructeur |
473 |
|
INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'dossier_modifier_instructeur', '2'); |
474 |
|
|
475 |
|
-- Module 1 |
476 |
|
CREATE TABLE dossier_autorisation_type ( |
477 |
|
dossier_autorisation_type integer, |
478 |
|
code character varying(20), |
479 |
|
libelle character varying(100), |
480 |
|
description text, |
481 |
|
confidentiel boolean default FALSE |
482 |
|
); |
483 |
|
|
484 |
|
ALTER TABLE ONLY dossier_autorisation_type |
485 |
|
ADD CONSTRAINT dossier_autorisation_type_pkey PRIMARY KEY (dossier_autorisation_type); |
486 |
|
|
487 |
|
CREATE SEQUENCE dossier_autorisation_type_seq |
488 |
|
INCREMENT 1 |
489 |
|
MINVALUE 1 |
490 |
|
MAXVALUE 9223372036854775807 |
491 |
|
START 1 |
492 |
|
CACHE 1; |
493 |
|
|
494 |
|
-- |
495 |
|
|
496 |
|
CREATE TABLE dossier_autorisation_type_detaille ( |
497 |
|
dossier_autorisation_type_detaille integer, |
498 |
|
code character varying(20), |
499 |
|
libelle character varying(100), |
500 |
|
description text, |
501 |
|
dossier_autorisation_type integer |
502 |
|
); |
503 |
|
|
504 |
|
ALTER TABLE ONLY dossier_autorisation_type_detaille |
505 |
|
ADD CONSTRAINT dossier_autorisation_type_detaille_pkey PRIMARY KEY (dossier_autorisation_type_detaille); |
506 |
|
ALTER TABLE ONLY dossier_autorisation_type_detaille |
507 |
|
ADD CONSTRAINT dossier_autorisation_type_detaille_dossier_autorisation_type_fkey FOREIGN KEY (dossier_autorisation_type) REFERENCES dossier_autorisation_type(dossier_autorisation_type); |
508 |
|
|
509 |
|
CREATE SEQUENCE dossier_autorisation_type_detaille_seq |
510 |
|
INCREMENT 1 |
511 |
|
MINVALUE 1 |
512 |
|
MAXVALUE 9223372036854775807 |
513 |
|
START 1 |
514 |
|
CACHE 1; |
515 |
|
|
516 |
|
-- |
517 |
|
|
518 |
|
CREATE TABLE dossier_instruction_type ( |
519 |
|
dossier_instruction_type integer, |
520 |
|
code character varying(20), |
521 |
|
libelle character varying(100), |
522 |
|
description text, |
523 |
|
dossier_autorisation_type_detaille integer, |
524 |
|
suffixe boolean default FALSE |
525 |
|
); |
526 |
|
|
527 |
|
ALTER TABLE ONLY dossier_instruction_type |
528 |
|
ADD CONSTRAINT dossier_instruction_type_pkey PRIMARY KEY (dossier_instruction_type); |
529 |
|
ALTER TABLE ONLY dossier_instruction_type |
530 |
|
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); |
531 |
|
|
532 |
|
CREATE SEQUENCE dossier_instruction_type_seq |
533 |
|
INCREMENT 1 |
534 |
|
MINVALUE 1 |
535 |
|
MAXVALUE 9223372036854775807 |
536 |
|
START 1 |
537 |
|
CACHE 1; |
538 |
|
|
539 |
|
-- |
540 |
|
|
541 |
|
CREATE TABLE demande_genre ( |
542 |
|
demande_genre integer, |
543 |
|
code character varying(20), |
544 |
|
libelle character varying(100), |
545 |
|
description text |
546 |
|
); |
547 |
|
|
548 |
|
ALTER TABLE ONLY demande_genre |
549 |
|
ADD CONSTRAINT demande_genre_pkey PRIMARY KEY (demande_genre); |
550 |
|
|
551 |
|
CREATE SEQUENCE demande_genre_seq |
552 |
|
INCREMENT 1 |
553 |
|
MINVALUE 1 |
554 |
|
MAXVALUE 9223372036854775807 |
555 |
|
START 1 |
556 |
|
CACHE 1; |
557 |
|
|
558 |
|
-- |
559 |
|
|
560 |
|
CREATE TABLE groupe ( |
561 |
|
groupe integer, |
562 |
|
code character varying(20), |
563 |
|
libelle character varying(100), |
564 |
|
description text, |
565 |
|
demande_genre integer |
566 |
|
); |
567 |
|
|
568 |
|
ALTER TABLE ONLY groupe |
569 |
|
ADD CONSTRAINT groupe_pkey PRIMARY KEY (groupe); |
570 |
|
ALTER TABLE ONLY groupe |
571 |
|
ADD CONSTRAINT groupe_demande_genre_fkey FOREIGN KEY (demande_genre) REFERENCES demande_genre(demande_genre); |
572 |
|
|
573 |
|
CREATE SEQUENCE groupe_seq |
574 |
|
INCREMENT 1 |
575 |
|
MINVALUE 1 |
576 |
|
MAXVALUE 9223372036854775807 |
577 |
|
START 1 |
578 |
|
CACHE 1; |
579 |
|
|
580 |
|
-- Ajout de clé étrangère à la table dossier_autorisation_type |
581 |
|
ALTER TABLE dossier_autorisation_type ADD COLUMN groupe integer; |
582 |
|
ALTER TABLE ONLY dossier_autorisation_type |
583 |
|
ADD CONSTRAINT dossier_autorisation_type_groupe_fkey FOREIGN KEY (groupe) REFERENCES groupe(groupe); |
584 |
|
|
585 |
|
--Demande nature |
586 |
|
|
587 |
|
CREATE TABLE demande_nature ( |
588 |
|
demande_nature integer, |
589 |
|
code character varying(20), |
590 |
|
libelle character varying(100), |
591 |
|
description text |
592 |
|
); |
593 |
|
|
594 |
|
ALTER TABLE ONLY demande_nature |
595 |
|
ADD CONSTRAINT demande_nature_pkey PRIMARY KEY (demande_nature); |
596 |
|
|
597 |
|
CREATE SEQUENCE demande_nature_seq |
598 |
|
INCREMENT 1 |
599 |
|
MINVALUE 1 |
600 |
|
MAXVALUE 9223372036854775807 |
601 |
|
START 1 |
602 |
|
CACHE 1; |
603 |
|
|
604 |
|
--Demande type |
605 |
|
|
606 |
|
CREATE TABLE demande_type ( |
607 |
|
demande_type integer, |
608 |
|
code character varying(20), |
609 |
|
libelle character varying(100), |
610 |
|
description text, |
611 |
|
demande_nature integer, |
612 |
|
groupe integer, |
613 |
|
dossier_instruction_type integer, |
614 |
|
dossier_autorisation_type_detaille integer, |
615 |
|
contraintes character varying(20), |
616 |
|
etats_dossier_autorisation_autorises character varying(100), |
617 |
|
qualification boolean, |
618 |
|
evenement integer |
619 |
|
); |
620 |
|
|
621 |
|
ALTER TABLE ONLY demande_type |
622 |
|
ADD CONSTRAINT demande_type_pkey PRIMARY KEY (demande_type); |
623 |
|
ALTER TABLE ONLY demande_type |
624 |
|
ADD CONSTRAINT demande_type_demande_nature_fkey FOREIGN KEY (demande_nature) REFERENCES demande_nature(demande_nature); |
625 |
|
ALTER TABLE ONLY demande_type |
626 |
|
ADD CONSTRAINT demande_type_groupe_fkey FOREIGN KEY (groupe) REFERENCES groupe(groupe); |
627 |
|
ALTER TABLE ONLY demande_type |
628 |
|
ADD CONSTRAINT demande_type_dossier_instruction_type_fkey FOREIGN KEY (dossier_instruction_type) REFERENCES dossier_instruction_type(dossier_instruction_type); |
629 |
|
ALTER TABLE ONLY demande_type |
630 |
|
ADD CONSTRAINT demande_type_dossier_autorisation_type_detaille_fkey FOREIGN KEY (dossier_autorisation_type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille); |
631 |
|
ALTER TABLE ONLY demande_type |
632 |
|
ADD CONSTRAINT demande_type_evenement_fkey FOREIGN KEY (evenement) REFERENCES evenement(evenement); |
633 |
|
|
634 |
|
CREATE SEQUENCE demande_type_seq |
635 |
|
INCREMENT 1 |
636 |
|
MINVALUE 1 |
637 |
|
MAXVALUE 9223372036854775807 |
638 |
|
START 1 |
639 |
|
CACHE 1; |
640 |
|
|
641 |
|
-- |
642 |
|
|
643 |
|
CREATE TABLE lien_evenement_dossier_autorisation_type ( |
644 |
|
lien_evenement_dossier_autorisation_type integer, |
645 |
|
evenement integer, |
646 |
|
dossier_autorisation_type integer |
647 |
|
); |
648 |
|
|
649 |
|
ALTER TABLE ONLY lien_evenement_dossier_autorisation_type |
650 |
|
ADD CONSTRAINT lien_evenement_dossier_autorisation_type_pkey PRIMARY KEY (lien_evenement_dossier_autorisation_type); |
651 |
|
ALTER TABLE ONLY lien_evenement_dossier_autorisation_type |
652 |
|
ADD CONSTRAINT lien_evenement_dossier_autorisation_type_evenement_fkey FOREIGN KEY (evenement) REFERENCES evenement(evenement); |
653 |
|
ALTER TABLE ONLY lien_evenement_dossier_autorisation_type |
654 |
|
ADD CONSTRAINT lien_evenement_dossier_autorisation_type_dossier_autorisation_type_fkey FOREIGN KEY (dossier_autorisation_type) REFERENCES dossier_autorisation_type(dossier_autorisation_type); |
655 |
|
|
656 |
|
CREATE SEQUENCE lien_evenement_dossier_autorisation_type_seq |
657 |
|
INCREMENT 1 |
658 |
|
MINVALUE 1 |
659 |
|
MAXVALUE 9223372036854775807 |
660 |
|
START 1 |
661 |
|
CACHE 1; |
662 |
|
|
663 |
|
-- |
664 |
|
|
665 |
|
CREATE TABLE autorite_competente ( |
666 |
|
autorite_competente integer, |
667 |
|
code character varying(20), |
668 |
|
libelle character varying(100), |
669 |
|
description text |
670 |
|
); |
671 |
|
|
672 |
|
ALTER TABLE ONLY autorite_competente |
673 |
|
ADD CONSTRAINT autorite_competente_pkey PRIMARY KEY (autorite_competente); |
674 |
|
|
675 |
|
CREATE SEQUENCE autorite_competente_seq |
676 |
|
INCREMENT 1 |
677 |
|
MINVALUE 1 |
678 |
|
MAXVALUE 9223372036854775807 |
679 |
|
START 1 |
680 |
|
CACHE 1; |
681 |
|
|
682 |
|
-- Ajout de clé étrangère à la table dossier_autorisation_type |
683 |
|
ALTER TABLE dossier ADD COLUMN autorite_competente integer; |
684 |
|
ALTER TABLE ONLY dossier |
685 |
|
ADD CONSTRAINT dossier_autorite_competente_fkey FOREIGN KEY (autorite_competente) REFERENCES autorite_competente(autorite_competente); |
686 |
|
|
687 |
|
-- Donnees des tables |
688 |
|
INSERT INTO dossier_autorisation_type(dossier_autorisation_type, code, libelle) SELECT nextval('dossier_autorisation_type_seq'), nature, libelle FROM nature; |
689 |
|
INSERT INTO dossier_autorisation_type_detaille(dossier_autorisation_type_detaille, code, libelle) SELECT nextval('dossier_autorisation_type_seq'), nature, libelle FROM nature; |
690 |
|
|
691 |
|
INSERT INTO demande_genre VALUES (nextval('demande_genre_seq'), 'URBA', 'Pôle Urbanisme', 'Responsabilité de la DDU'); |
692 |
|
INSERT INTO demande_genre VALUES (nextval('demande_genre_seq'), 'ERP', 'Pôle ERP', 'Responsabilité de la DGUP'); |
693 |
|
|
694 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'ADS', 'Autorisation ADS', '',1); |
695 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'CTX', 'Contentieux dans le domaine urbanisme', '',1); |
696 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'CU', 'Changement d''usage', '',1); |
697 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'RU', 'Renseignement d''urbanisme', '',1); |
698 |
|
INSERT INTO groupe VALUES (nextval('groupe_seq'), 'ERP', 'ERP', '',2); |
699 |
|
|
700 |
|
-- Table Demande |
701 |
|
|
702 |
|
CREATE TABLE demande ( |
703 |
|
demande integer, |
704 |
|
dossier_autorisation_type_detaille integer, |
705 |
|
demande_type integer, |
706 |
|
date_demande date, |
707 |
|
terrain_references_cadastrales character varying(100), |
708 |
|
terrain_adresse_voie_numero integer, |
709 |
|
complement character varying(30), |
710 |
|
terrain_adresse_lieu_dit character varying(30), |
711 |
|
terrain_adresse_localite character varying(30), |
712 |
|
terrain_adresse_code_postal character varying(5), |
713 |
|
terrain_adresse_bp character varying(15), |
714 |
|
terrain_adresse_cedex character varying(15), |
715 |
|
terrain_superficie double precision, |
716 |
|
nombre_lots integer |
717 |
|
); |
718 |
|
|
719 |
|
ALTER TABLE ONLY demande |
720 |
|
ADD CONSTRAINT demande_pkey PRIMARY KEY (demande); |
721 |
|
ALTER TABLE ONLY demande |
722 |
|
ADD CONSTRAINT demande_dossier_autorisation_type_detaille_fkey FOREIGN KEY (dossier_autorisation_type_detaille) REFERENCES dossier_autorisation_type_detaille(dossier_autorisation_type_detaille); |
723 |
|
ALTER TABLE ONLY demande |
724 |
|
ADD CONSTRAINT demande_type_demande_type_fkey FOREIGN KEY (demande_type) REFERENCES demande_type(demande_type); |
725 |
|
|
726 |
|
CREATE SEQUENCE demande_seq |
727 |
|
INCREMENT 1 |
728 |
|
MINVALUE 1 |
729 |
|
MAXVALUE 9223372036854775807 |
730 |
|
START 1 |
731 |
|
CACHE 1; |
732 |
|
|
733 |
|
-- Table Demandeur |
734 |
|
|
735 |
|
CREATE TABLE demandeur ( |
736 |
|
demandeur integer, |
737 |
|
type_demandeur character varying(40), |
738 |
|
particulier_civilite character varying(10), |
739 |
|
particulier_nom character varying(40), |
740 |
|
particulier_prenom character varying(40), |
741 |
|
particulier_date_naissance date, |
742 |
|
particulier_commune_naissance character varying(30), |
743 |
|
particulier_departement_naissance character varying(80), |
744 |
|
personne_morale_denomination character varying(15), |
745 |
|
personne_morale_raison_sociale character varying(15), |
746 |
|
personne_morale_siret character varying(15), |
747 |
|
personne_morale_categorie_juridique character varying(15), |
748 |
|
personne_morale_civilite character varying(10), |
749 |
|
personne_morale_nom character varying(40), |
750 |
|
personne_morale_prenom character varying(40), |
751 |
|
numero character varying(5), |
752 |
|
voie character varying(40), |
753 |
|
complement character varying(39), |
754 |
|
lieu_dit character varying(39), |
755 |
|
localite character varying(30), |
756 |
|
code_postal character varying(5), |
757 |
|
bp character varying(5), |
758 |
|
cedex character varying(5), |
759 |
|
pays character varying(40), |
760 |
|
division_territoriale character varying(40), |
761 |
|
telephone_fixe character varying(14), |
762 |
|
telephone_mobile character varying(14), |
763 |
|
indicatif character varying(5), |
764 |
|
courriel character varying(40), |
765 |
|
notification boolean, |
766 |
|
frequent boolean, |
767 |
|
demande integer |
768 |
|
); |
769 |
|
|
770 |
|
ALTER TABLE ONLY demandeur |
771 |
|
ADD CONSTRAINT demandeur_pkey PRIMARY KEY (demandeur); |
772 |
|
ALTER TABLE ONLY demandeur |
773 |
|
ADD CONSTRAINT demandeur_particulier_civilite_fkey FOREIGN KEY (particulier_civilite) REFERENCES civilite(civilite); |
774 |
|
ALTER TABLE ONLY demandeur |
775 |
|
ADD CONSTRAINT demandeur_personne_morale_civilite_fkey FOREIGN KEY (personne_morale_civilite) REFERENCES civilite(civilite); |
776 |
|
ALTER TABLE ONLY demandeur |
777 |
|
ADD CONSTRAINT demandeur_demande_fkey FOREIGN KEY (demande) REFERENCES demande(demande); |
778 |
|
|
779 |
|
CREATE SEQUENCE demandeur_seq |
780 |
|
INCREMENT 1 |
781 |
|
MINVALUE 1 |
782 |
|
MAXVALUE 9223372036854775807 |
783 |
|
START 1 |
784 |
|
CACHE 1; |
785 |
|
|
786 |
|
-- Table lot |
787 |
|
|
788 |
|
CREATE TABLE lot ( |
789 |
|
lot integer, |
790 |
|
dossier character varying(12) |
791 |
|
); |
792 |
|
|
793 |
|
ALTER TABLE ONLY lot |
794 |
|
ADD CONSTRAINT lot_pkey PRIMARY KEY (lot); |
795 |
|
ALTER TABLE ONLY lot |
796 |
|
ADD CONSTRAINT lot_dossier_fkey FOREIGN KEY (dossier) REFERENCES dossier(dossier); |
797 |
|
|
798 |
|
CREATE SEQUENCE lot_seq |
799 |
|
INCREMENT 1 |
800 |
|
MINVALUE 1 |
801 |
|
MAXVALUE 9223372036854775807 |
802 |
|
START 1 |
803 |
|
CACHE 1; |
804 |
|
|
805 |
|
-- Table lien_lot_demandeur |
806 |
|
|
807 |
|
CREATE TABLE lien_lot_demandeur ( |
808 |
|
lien_lot_demandeur integer, |
809 |
|
lot integer, |
810 |
|
demandeur integer |
811 |
|
); |
812 |
|
|
813 |
|
ALTER TABLE ONLY lien_lot_demandeur |
814 |
|
ADD CONSTRAINT lien_lot_demandeur_pkey PRIMARY KEY (lien_lot_demandeur); |
815 |
|
ALTER TABLE ONLY lien_lot_demandeur |
816 |
|
ADD CONSTRAINT lien_lot_demandeur_lot_fkey FOREIGN KEY (lot) REFERENCES lot(lot); |
817 |
|
ALTER TABLE ONLY lien_lot_demandeur |
818 |
|
ADD CONSTRAINT lien_lot_demandeur_demandeur_fkey FOREIGN KEY (demandeur) REFERENCES demandeur(demandeur); |
819 |
|
|
820 |
|
CREATE SEQUENCE lien_lot_demandeur_seq |
821 |
|
INCREMENT 1 |
822 |
|
MINVALUE 1 |
823 |
|
MAXVALUE 9223372036854775807 |
824 |
|
START 1 |
825 |
|
CACHE 1; |