Commit 6306a650 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Corrections de scripts SQL de migration et d'install de bdd

parent ffe18fe3
Loading
Loading
Loading
Loading
+22 −8
Changes for bin/database/src/sql/init.template.sql: 22 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -99,15 +99,29 @@ where s.source_code = '{ETAB_CODE}'
;

--
-- Accord des privilèges de "gestion des privilèges" au rôle ADMIN_TECH.
-- NB: cela débloque l'accès au menu "Droits d'accès" dans l'appli.
--
-- Accord de tous les privilèges au rôle ADMIN_TECH.
--
insert into profil_privilege(profil_id, privilege_id)
select pro.id, pri.id
from profil pro,
     privilege pri
where pro.role_id = 'ADMIN_TECH'
  and not exists(select * from profil_privilege where profil_id = pro.id and privilege_id = pri.id)
;
insert into role_privilege(role_id, privilege_id)
select r.id, p.id
from role r, privilege p, categorie_privilege cp
where r.SOURCE_CODE = 'ADMIN_TECH'
  and cp.CODE = 'droit'
  and p.CATEGORIE_ID = cp.id
select r.id, pri.id
from role r,
     privilege pri
where r.code = 'ADMIN_TECH'
  and not exists(select * from role_privilege where role_id = r.id and privilege_id = pri.id)
;
insert into profil_to_role(profil_id, role_id)
select pro.id, r.id
from profil pro,
     role r
where pro.role_id = 'ADMIN_TECH'
  and r.code = 'ADMIN_TECH'
  and not exists(select * from profil_to_role where profil_id = pro.id and role_id = r.id)
;


+3 −2
Changes for bin/database/src/sql/insert_bootstrap_data.template.sql: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -57,12 +57,13 @@ select nextval('structure_id_seq'),
       'ETAB_INCONNU', -- source code unique
       'INCONNU' -- code
;
insert into etablissement(id, structure_id, histo_createur_id, histo_modificateur_id, source_id, source_code)
insert into etablissement(id, structure_id, histo_createur_id, histo_modificateur_id, source_id, source_code, est_etab_inscription)
select nextval('etablissement_id_seq'),
       currval('structure_id_seq'),
       1, 1,
       1, -- source sygal
       'ETAB_INCONNU' -- source code unique, idem structure
       'ETAB_INCONNU', -- source code unique, idem structure
       true
;

-- --
+2 −2
Changes for migration/docker/pg_after_import.sql: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -2,9 +2,9 @@
--
-- Correction de la vue `src_role` : colonne `these_dep` => booléen
--
drop view v_diff_role
drop view if exists v_diff_role
;
drop view src_role
drop view if exists src_role
;
create or replace view src_role
            (id, source_code, source_id, libelle, code, role_id, these_dep, structure_id,