/* MSIN - Acces evenement v2 (phase 3) - role_delegable pour kits promoteur Executer APRES phase 1 + phase 2 (+ bib-qr seed si applicable). */ SET NAMES utf8mb4; /* Ajout idempotent : n'ajoute la colonne que si elle n'existe pas deja (evite l'erreur 1060 - Duplicate column name si le script est relance). */ SET @col_exists := ( SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'inscriptions_eve_roles' AND COLUMN_NAME = 'role_delegable' ); SET @ddl := IF(@col_exists = 0, 'ALTER TABLE `inscriptions_eve_roles` ADD COLUMN `role_delegable` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT ''Proposable par le promoteur lors d invitations equipe'' AFTER `role_systeme`', 'DO 0'); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; UPDATE `inscriptions_eve_roles` SET `role_delegable` = 1 WHERE `role_code` IN ( 'gestion_ops', 'gestion_readonly', 'gestion_statut', 'bib_ops' );