Commit 57d16645 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

up

parent a454c4a0
Loading
Loading
Loading
Loading
+438 −26

File changed.

Preview size limit exceeded, changes collapsed.

+80 −2
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ create table carriere_categorie
    libelle               varchar(1024) not null,
    histo_creation        timestamp     not null,
    histo_createur_id     integer       not null    constraint categorie_user_id_fk references unicaen_utilisateur_user,
    histo_modification    timestamp     not null,
    histo_modificateur_id integer       not null    constraint categorie_user_id_fk_2 references unicaen_utilisateur_user,
    histo_modification    timestamp     ,
    histo_modificateur_id integer                   constraint categorie_user_id_fk_2 references unicaen_utilisateur_user,
    histo_destruction     timestamp,
    histo_destructeur_id  integer                   constraint categorie_user_id_fk_3 references unicaen_utilisateur_user
);
@@ -101,3 +101,81 @@ create table carriere_grade
    histo_modificateur_id bigint,
    histo_destructeur_id  bigint
);


-------------------------------------------------------------------------------------------------------------
-- DATA -----------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

INSERT INTO carriere_categorie (code, libelle, histo_creation, histo_createur_id) VALUES ('A', 'La catégorie A', now(), 0);
INSERT INTO carriere_categorie (code, libelle, histo_creation, histo_createur_id) VALUES ('B', 'La catégorie B', now(), 0);
INSERT INTO carriere_categorie (code, libelle, histo_creation, histo_createur_id) VALUES ('C', 'La catégorie C', now(), 0);


--------------------------------------------------------------------------------------------------------------
-- PARAMS ----------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------

INSERT INTO unicaen_parametre_categorie (code, libelle, ordre) VALUES ('CARRIERE', 'Paramètre du module Carrière', 2);
INSERT INTO unicaen_parametre_parametre(CATEGORIE_ID, CODE, LIBELLE, DESCRIPTION, VALEURS_POSSIBLES, VALEUR, ORDRE)
WITH d(CODE, LIBELLE, DESCRIPTION, VALEURS_POSSIBLES, VALEUR, ORDRE) AS (
    SELECT 'CorpsAvecAgent', 'Affichage seulement des corps avec agent', null, 'Boolean', 'true', 100 UNION
    SELECT 'GradeAvecAgent', 'Affichage seulement des grades avec agent', null, 'Boolean', 'true', 200 UNION
    SELECT 'CorrespondanceAvecAgent', 'Affichage seulement des correspondance ayant un agent', null, 'Boolean', 'true', 30
)
SELECT cp.id, d.CODE, d.LIBELLE, d.DESCRIPTION, d.VALEURS_POSSIBLES, d.VALEUR, d.ORDRE
FROM d
JOIN unicaen_parametre_categorie cp ON cp.CODE = 'CARRIERE';


--------------------------------------------------------------------------------------------------------------
-- PRIVILEGE -------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('categorie', 'Gestion des catégories (carrière)', 600, 'Carriere\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'categorie_index', 'Accéder à l''index des catégories', 10 UNION
    SELECT 'categorie_afficher', 'Afficher une catégorie', 20 UNION
    SELECT 'categorie_modifier', 'Modifier une catégorie', 30
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
JOIN unicaen_privilege_categorie cp ON cp.CODE = 'categorie';

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('corps', 'Gestion des corps', 610, 'Carriere\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'corps_index', 'Accéder à l''index des corps', 10 UNION
    SELECT 'corps_afficher', 'Afficher les corps', 20 UNION
    SELECT 'corps_modifier', 'Modifier un corps', 30
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
JOIN unicaen_privilege_categorie cp ON cp.CODE = 'corps';

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('grade', 'Gestion des grades', 620, 'Carriere\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'grade_index', 'Accéder à l''index des grades', 10 UNION
    SELECT 'grade_afficher', 'Afficher un grade', 20 UNION
    SELECT 'grade_modifier', 'Modifier un grade', 30
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
JOIN unicaen_privilege_categorie cp ON cp.CODE = 'grade';

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('correspondance', 'Gestion des correspondances', 630, 'Carriere\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'correspondance_index', 'Accéder à l''index des correspondances', 10 UNION
    SELECT 'correspondance_afficher', 'Afficher une correspondance', 20 UNION
    SELECT 'correspondance_modifier', 'Modifier une correspondance', 30
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
         JOIN unicaen_privilege_categorie cp ON cp.CODE = 'correspondance';
 No newline at end of file
+241 −0
Original line number Diff line number Diff line
create table metier_familleprofessionnelle
(
    id                    serial
        constraint metier_famille_pk
        primary key,
    libelle               varchar(128)            not null,
    couleur               varchar(64),
    histo_creation        timestamp default now() not null,
    histo_createur_id     integer   default 0     not null
        constraint famille_professionnelle_user_id_fk
        references unicaen_utilisateur_user,
    histo_modification    timestamp,
    histo_modificateur_id integer
        constraint famille_professionnelle_user_id_fk_2
        references unicaen_utilisateur_user,
    histo_destruction     timestamp,
    histo_destructeur_id  integer
        constraint famille_professionnelle_user_id_fk_3
        references unicaen_utilisateur_user
);

create unique index metier_famille_id_uindex
    on metier_familleprofessionnelle (id);

create table metier_domaine
(
    id                    serial
        constraint domaine_pk
        primary key,
    libelle               varchar(256)            not null,
    famille_id            integer
        constraint domaine_famille_professionnelle_id_fk
        references metier_familleprofessionnelle,
    type_fonction         varchar(256),
    histo_creation        timestamp default now() not null,
    histo_createur_id     integer   default 0     not null
        constraint domaine_user_id_fk
        references unicaen_utilisateur_user,
    histo_modification    timestamp,
    histo_modificateur_id integer
        constraint domaine_user_id_fk_2
        references unicaen_utilisateur_user,
    histo_destruction     timestamp,
    histo_destructeur_id  integer
        constraint domaine_user_id_fk_3
        references unicaen_utilisateur_user
);

create unique index domaine_id_uindex
    on metier_domaine (id);

create table metier_metier
(
    id                    serial
        constraint metier_pkey
        primary key,
    libelle_default       varchar(256)            not null,
    niveau                integer,
    libelle_feminin       varchar(256),
    libelle_masculin      varchar(256),
    categorie_id          integer
        constraint metier_categorie_id_fk
        references carriere_categorie
        on delete set null,
    niveaux_id            integer
        constraint metier_niveau_enveloppe_id_fk
        references carriere_niveau_enveloppe
        on delete set null,
    histo_creation        timestamp default now() not null,
    histo_createur_id     integer   default 0     not null
        constraint metier_user_id_fk
        references unicaen_utilisateur_user,
    histo_modification    timestamp,
    histo_modificateur_id integer
        constraint metier_user_id_fk_2
        references unicaen_utilisateur_user,
    histo_destruction     timestamp,
    histo_destructeur_id  integer
        constraint metier_user_id_fk_3
        references unicaen_utilisateur_user
);


create unique index metier_id_uindex
    on metier_metier (id);

create table metier_metier_domaine
(
    metier_id  integer not null
        constraint metier_domaine_metier_id_fk
        references metier_metier
        on delete cascade,
    domaine_id integer not null
        constraint metier_domaine_domaine_id_fk
        references metier_domaine
        on delete cascade,
    constraint metier_domaine_pk
        primary key (metier_id, domaine_id)
);

create table metier_referentiel
(
    id                    serial
        constraint metier_referentiel_pk
        primary key,
    libelle_court         varchar(256)  not null,
    libelle_long          varchar(1024) not null,
    prefix                varchar(1024) not null,
    type                  varchar(255),
    histo_creation        timestamp     not null,
    histo_createur_id     integer       not null
        constraint metier_referentiel_user_id_fk
        references unicaen_utilisateur_user,
    histo_modification    timestamp     not null,
    histo_modificateur_id integer       not null
        constraint metier_referentiel_user_id_fk_2
        references unicaen_utilisateur_user,
    histo_destruction     timestamp,
    histo_destructeur_id  integer
        constraint metier_referentiel_user_id_fk_3
        references unicaen_utilisateur_user
);


create unique index metier_referentiel_id_uindex
    on metier_referentiel (id);

create table metier_reference
(
    id                    serial
        constraint metier_reference_pk
        primary key,
    metier_id             integer      not null
        constraint metier_reference_metier_id_fk
        references metier_metier
        on delete cascade,
    referentiel_id        integer      not null
        constraint metier_reference_metier_referentiel_id_fk
        references metier_referentiel
        on delete cascade,
    code                  varchar(256) not null,
    lien                  varchar(1024),
    page                  integer,
    histo_creation        timestamp    not null,
    histo_createur_id     integer      not null
        constraint metier_reference_user_id_fk
        references unicaen_utilisateur_user,
    histo_modification    timestamp    not null,
    histo_modificateur_id integer      not null
        constraint metier_reference_user_id_fk_2
        references unicaen_utilisateur_user,
    histo_destruction     timestamp,
    histo_destructeur_id  integer
        constraint metier_reference_user_id_fk_3
        references unicaen_utilisateur_user
);


create unique index metier_reference_id_uindex
    on metier_reference (id);


----------------------------------------------------------------------------------------
-- PRIVILEGE ---------------------------------------------------------------------------
----------------------------------------------------------------------------------------

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('domaine', 'Gestion des domaines', 552, 'Metier\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'domaine_index', 'Afficher l''index ', 10 UNION
    SELECT 'domaine_afficher', 'Afficher un domaine', 20 UNION
    SELECT 'domaine_ajouter', 'Ajouter un domaine', 30 UNION
    SELECT 'domaine_modifier', 'Modifier un domaine', 40 UNION
    SELECT 'domaine_historiser', 'Historiser/Restaurer un domaine', 50 UNION
    SELECT 'domaine_supprimer', 'Supprimer un domaine', 60
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
JOIN unicaen_privilege_categorie cp ON cp.CODE = 'domaine';

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('familleProfessionnelle', 'Gestion des familles professionnelles ', 553, 'Metier\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'famille_professionnelle_index', 'Afficher l''index', 10 UNION
    SELECT 'famille_professionnelle_afficher', 'Afficher une famille professionnelle', 20 UNION
    SELECT 'famille_professionnelle_ajouter', 'Ajouter une famille professionnelle', 30 UNION
    SELECT 'famille_professionnelle_modifier', 'Modifier une famille professionnelle', 40 UNION
    SELECT 'famille_professionnelle_historiser', 'Historiser/Restaurer une famille professionnelle', 50 UNION
    SELECT 'famille_professionnelle_supprimer', 'Supprimer une famille professionnelle', 60
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
JOIN unicaen_privilege_categorie cp ON cp.CODE = 'familleProfessionnelle';

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('metier', 'Gestion des métiers', 551, 'Metier\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'metier_index', 'Afficher l''index des métiers', 10 UNION
    SELECT 'metier_afficher', 'Afficher un métier', 20 UNION
    SELECT 'metier_ajouter', 'Ajouter un métier', 30 UNION
    SELECT 'metier_modifier', 'Modifier un métier', 40 UNION
    SELECT 'metier_historiser', 'Historiser/Réstaurer un métier', 50 UNION
    SELECT 'metier_supprimer', 'Supprimer un métier', 60 UNION
    SELECT 'metier_cartographie', 'Extraire la cartographie', 100
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
 JOIN unicaen_privilege_categorie cp ON cp.CODE = 'metier';

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('referentielMetier', 'Gestion des référentiels métiers', 554, 'Metier\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'referentiel_index', 'Afficher l''index des référentiels métiers', 10 UNION
    SELECT 'referentiel_afficher', 'Afficher un référentiel métier', 20 UNION
    SELECT 'referentiel_ajouter', 'Ajouter un référentiel métier', 30 UNION
    SELECT 'referentiel_modifier', 'Modifier un référentiel métier', 40 UNION
    SELECT 'referentiel_historiser', 'Historiser/Restaurer un référentiel métier', 50 UNION
    SELECT 'referentiel_supprimer', 'Supprimer un référentiel métier', 60
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
JOIN unicaen_privilege_categorie cp ON cp.CODE = 'referentielMetier';

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('referenceMetier', 'Gestion des références métiers', 555, 'Metier\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'reference_index', 'Afficher l''indes des références métiers', 10 UNION
    SELECT 'reference_afficher', 'Afficher une référence métier', 20 UNION
    SELECT 'reference_ajouter', 'Ajouter une référence métier', 30 UNION
    SELECT 'reference_modifier', 'Modifier une référence métier', 40 UNION
    SELECT 'reference_historiser', 'Historiser/Restaurer une référence métier', 50 UNION
    SELECT 'reference_supprimer', 'Supprimer une référence métier', 60
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
JOIN unicaen_privilege_categorie cp ON cp.CODE = 'referenceMetier';
 No newline at end of file
+127 −0
Original line number Diff line number Diff line
@@ -328,3 +328,130 @@ create table formation
create unique index formation_id_uindex
    on formation (id);

create table formation_element
(
    id                    serial
        constraint formation_element_pk
            primary key,
    formation_id          integer   not null
        constraint formation_element_formation_informations_id_fk
            references formation
            on delete cascade,
    commentaire           text,
    validation_id         integer
        constraint formation_element_unicaen_validation_instance_id_fk
            references unicaen_validation_instance
            on delete set null,
    histo_creation        timestamp not null,
    histo_createur_id     integer   not null
        constraint formation_element_unicaen_utilisateur_user_id_fk
            references unicaen_utilisateur_user,
    histo_modification    timestamp,
    histo_modificateur_id integer
        constraint formation_element_unicaen_utilisateur_user_id_fk_2
            references unicaen_utilisateur_user,
    histo_destruction     timestamp,
    histo_destructeur_id  integer
        constraint formation_element_unicaen_utilisateur_user_id_fk_3
            references unicaen_utilisateur_user
);

create unique index formation_element_id_uindex
    on formation_element (id);

create table formation_obtenue_application
(
    formation_id integer not null constraint formation_application_obtenue_formation_id_fk references formation on delete cascade,
    application_element_id integer not null constraint formation_application_obtenue_application_element_id_fk references element_application_element on delete cascade,
    constraint formation_application_obtenue_pk primary key (formation_id, application_element_id)
);

create table formation_obtenue_competence
(
    formation_id integer not null constraint formation_obtenue_competence_formation_id_fk references formation on delete cascade,
    competence_element_id integer not null constraint formation_obtenue_competence_competence_element_id_fk references element_competence_element on delete cascade,
    constraint formation_obtenue_competence_pk primary key (formation_id, competence_element_id)
);


-----------------------------------------------------------------------------------------------------------
-- PRIVILEGE ----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------

INSERT INTO unicaen_privilege_categorie (code, libelle, namespace, ordre)
VALUES ('niveau', 'Gestion des niveaux', 'Element\Provider\Privilege', 70900);
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'niveau_index', 'Accéder à l''index des niveaux', 10 UNION
    SELECT 'niveau_afficher', 'Afficher un niveau', 20 UNION
    SELECT 'niveau_modifier', 'Modifier un niveau', 30 UNION
    SELECT 'niveau_effacer', 'Supprimer un niveau', 40
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
         JOIN unicaen_privilege_categorie cp ON cp.CODE = 'niveau';

INSERT INTO unicaen_privilege_categorie (code, libelle, namespace, ordre)
VALUES ('application', 'Gestion des applications', 'Element\Provider\Privilege', 70100);
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'application_index', 'Accéder à l''index', 10 UNION
    SELECT 'application_afficher', 'Afficher une application', 20 UNION
    SELECT 'application_modifier', 'Modifier une application', 30 UNION
    SELECT 'application_effacer', 'Supprimer une application', 40
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
         JOIN unicaen_privilege_categorie cp ON cp.CODE = 'application';

INSERT INTO unicaen_privilege_categorie (code, libelle, namespace, ordre)
VALUES ('applicationtheme', 'Gestion des thèmes d''application', 'Element\Provider\Privilege', 70200);
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'applicationtheme_index', 'Acceder à l''index des thèmes d''application', 10 UNION
    SELECT 'applicationtheme_afficher', 'Afficher un thème d''application', 20 UNION
    SELECT 'applicationtheme_modifier', 'Modifier un thème d''application', 30 UNION
    SELECT 'applicationtheme_effacer', 'Supprimer un thème d''application', 40
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
         JOIN unicaen_privilege_categorie cp ON cp.CODE = 'applicationtheme';

INSERT INTO unicaen_privilege_categorie (code, libelle, namespace, ordre)
VALUES ('competence', 'Gestion des compétences', 'Element\Provider\Privilege', 70500);
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'competence_index', 'Accéder à l''index des compétences', 10 UNION
    SELECT 'competence_afficher', 'Afficher une compétence', 20 UNION
    SELECT 'competence_modifier', 'Modifier une compétence', 30 UNION
    SELECT 'competence_effacer', 'Supprimer une compétence', 40
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
         JOIN unicaen_privilege_categorie cp ON cp.CODE = 'competence';

INSERT INTO unicaen_privilege_categorie (code, libelle, namespace, ordre)
VALUES ('competencetype', 'Gestions des types de compétence', 'Element\Provider\Privilege', 70700);
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'competencetype_index', 'Accéder à l''index des types de compétence', 10 UNION
    SELECT 'competencetype_afficher', 'Afficher un type de compétence', 20 UNION
    SELECT 'competencetype_modifier', 'Modifier un type de compétence', 30 UNION
    SELECT 'competencetype_effacer', 'Supprimer un type de compétence', 40
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
         JOIN unicaen_privilege_categorie cp ON cp.CODE = 'competencetype';

INSERT INTO unicaen_privilege_categorie (code, libelle, namespace, ordre)
VALUES ('competencetheme', 'Gestion des thèmes de compétence', 'Element\Provider\Privilege', 70600);
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'competencetheme_index', 'Accéder à l''index des thèmes de compétence', 10 UNION
    SELECT 'competencetheme_afficher', 'Afficher un thème de compétence', 20 UNION
    SELECT 'competencetheme_modifier', 'Modifier un thème de compétence', 30 UNION
    SELECT 'competencetheme_effacer', 'Supprimer un thème de compétence', 40
)
SELECT cp.id, d.code, d.lib, d.ordre
FROM d
         JOIN unicaen_privilege_categorie cp ON cp.CODE = 'competencetheme';
+13 −13
Original line number Diff line number Diff line
@@ -104,19 +104,19 @@ create table activite_competence
);


-- create table activite_formation
-- (
--     activite_id          integer not null
--         constraint activite_formation_activite_id_fk
--         references activite
--         on delete cascade,
--     formation_element_id integer not null
--         constraint activite_formation_formation_element_id_fk
--         references formation_element
--         on delete cascade,
--     constraint activite_formation_pk
--         primary key (activite_id, formation_element_id)
-- );
create table activite_formation
(
    activite_id          integer not null
        constraint activite_formation_activite_id_fk
        references activite
        on delete cascade,
    formation_element_id integer not null
        constraint activite_formation_formation_element_id_fk
        references formation_element
        on delete cascade,
    constraint activite_formation_pk
        primary key (activite_id, formation_element_id)
);


create table activite_domaine
Loading