/[openfoncier]/trunk/data/pgsql/v3.2.0-dev.sql
ViewVC logotype

Diff of /trunk/data/pgsql/v3.2.0-dev.sql

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 605 by nhaye, Tue Nov 6 09:36:32 2012 UTC revision 622 by vpihour, Wed Nov 7 14:41:45 2012 UTC
# Line 193  ALTER TABLE instruction ADD COLUMN avis_ Line 193  ALTER TABLE instruction ADD COLUMN avis_
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  --  --
# Line 253  INSERT INTO om_droit VALUES (nextval('om Line 256  INSERT INTO om_droit VALUES (nextval('om
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    
# Line 392  ALTER TABLE ONLY lien_localisation_natur Line 397  ALTER TABLE ONLY lien_localisation_natur
397  ALTER TABLE ONLY lien_localisation_nature  ALTER TABLE ONLY lien_localisation_nature
398      ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur);      ADD CONSTRAINT lien_localisation_nature_instructeur_fkey FOREIGN KEY (instructeur) REFERENCES instructeur(instructeur);
399    
400    CREATE SEQUENCE lien_localisation_nature_seq
401      INCREMENT 1
402      MINVALUE 1
403      MAXVALUE 9223372036854775807
404      START 1
405      CACHE 1;
406    
407  -- Ajout des droits pour le retour des services  -- Ajout des droits pour le retour des services
408  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_encours', '2');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'demande_avis_encours', '2');
409  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');
# Line 436  CREATE TABLE messages ( Line 448  CREATE TABLE messages (
448      type character varying(60),      type character varying(60),
449      emetteur character varying(40),      emetteur character varying(40),
450      date_emission DATE NOT NULL,      date_emission DATE NOT NULL,
     enjeux_erp boolean default FALSE,  
     enjeux_urba boolean default FALSE,  
451      lu boolean default FALSE,      lu boolean default FALSE,
452      FOREIGN KEY ( dossier ) REFERENCES dossier ( dossier ) -- add this      FOREIGN KEY ( dossier ) REFERENCES dossier ( dossier ) -- add this
453  );  );
# Line 446  ALTER SEQUENCE messages_seq OWNED BY mes Line 456  ALTER SEQUENCE messages_seq OWNED BY mes
456  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'menu_suivi', '2');  INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'menu_suivi', '2');
457    
458  -- Droit de l'ajout forcé d'un instructeur  -- Droit de l'ajout forcé d'un instructeur
 INSERT INTO om_droit VALUES (nextval('om_droit_seq'),'dossier_modifier_instructeur', '2');  
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);

Legend:
Removed from v.605  
changed lines
  Added in v.622

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26