Files
ms1inscription-v5/sql/MSIN-4484-perm-grants-all.sql

32 lines
1.1 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- MSIN-4484 — Permission catalogue : hors propagation kit total
-- Prérequis : inscriptions_eve_permissions (accès v2)
-- Notes : exécution UNIQUEMENT sur dev préprod ; autres env = Navicat structure + sync_static_db
-- Idempotent
--
-- perm_grants_all = 1 (défaut) : incluse dans role_grants_all (comportement actuel)
-- perm_grants_all = 0 : nest PAS accordée automatiquement par un kit total ;
-- seulement via matrice / extra explicite (ou gate hors catalogue)
SET NAMES utf8mb4;
SET @col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'inscriptions_eve_permissions'
AND COLUMN_NAME = 'perm_grants_all'
);
SET @sql := IF(
@col_exists = 0,
'ALTER TABLE `inscriptions_eve_permissions`
ADD COLUMN `perm_grants_all` tinyint(1) unsigned NOT NULL DEFAULT 1
COMMENT ''MSIN-4484 — 1 = incluse dans kit total (grants_all) ; 0 = non propagée''
AFTER `perm_actif`',
'SELECT ''perm_grants_all already exists'' AS info'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;