-- ========================================== -- SCRIPT DE CREATION DES TABLES REFERENTIELS -- À exécuter dans votre base de données de production -- ========================================== -- 1. Table liaisons (si elle n'existe pas) CREATE TABLE IF NOT EXISTS `liaisons` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` text DEFAULT NULL, `site_a_name` varchar(255) DEFAULT NULL, `site_b_name` varchar(255) DEFAULT NULL, `site_a_latitude` decimal(10,7) DEFAULT NULL, `site_a_longitude` decimal(10,7) DEFAULT NULL, `site_b_latitude` decimal(10,7) DEFAULT NULL, `site_b_longitude` decimal(10,7) DEFAULT NULL, `active` tinyint(1) DEFAULT 1, `created_at` timestamp DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- 2. Table sites (si elle n'existe pas) CREATE TABLE IF NOT EXISTS `sites` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` text DEFAULT NULL, `active` tinyint(1) DEFAULT 1, `created_at` timestamp DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- 3. Table priority_levels (si elle n'existe pas) CREATE TABLE IF NOT EXISTS `priority_levels` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, `sort_order` int(11) DEFAULT 10, `color` varchar(7) DEFAULT '#6c757d', `description` text DEFAULT NULL, `created_at` timestamp DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `sort_order` (`sort_order`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- 4. Table equipments (si elle n'existe pas) CREATE TABLE IF NOT EXISTS `equipments` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `category` varchar(100) DEFAULT NULL, `description` text DEFAULT NULL, `active` tinyint(1) DEFAULT 1, `created_at` timestamp DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `category` (`category`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- ========================================== -- INSERTION DES DONNEES D'EXEMPLE -- ========================================== -- Données pour priority_levels INSERT IGNORE INTO `priority_levels` (`name`, `sort_order`, `color`, `description`) VALUES ('Critique', 1, '#dc3545', 'Incident critique nécessitant une intervention immédiate'), ('Haute', 2, '#fd7e14', 'Incident à haute priorité'), ('Normale', 3, '#ffc107', 'Incident à priorité normale'), ('Basse', 4, '#28a745', 'Incident à basse priorité'); -- Données pour equipments INSERT IGNORE INTO `equipments` (`name`, `category`, `description`, `active`) VALUES ('Serveur principal', 'Serveur', 'Serveur de production principal', 1), ('Switch réseau', 'Réseau', 'Commutateur réseau principal', 1), ('Routeur', 'Réseau', 'Routeur de connexion internet', 1), ('Firewall', 'Sécurité', 'Pare-feu de sécurité', 1), ('Fibre optique', 'Fibre', 'Infrastructure fibre optique', 1), ('UPS', 'Infrastructure', 'Système d\'alimentation sans interruption', 1); -- Données pour liaisons INSERT IGNORE INTO `liaisons` (`name`, `description`, `active`) VALUES ('Liaison principale', 'Liaison fibre principale', 1), ('Liaison de secours', 'Liaison de backup', 1), ('Liaison interne', 'Liaison réseau interne', 1); -- Données pour sites INSERT IGNORE INTO `sites` (`name`, `description`, `active`) VALUES ('Abidjan Centre', 'Site principal d\'Abidjan', 1), ('Bouaké', 'Site de Bouaké', 1), ('San Pedro', 'Site de San Pedro', 1), ('Yamoussoukro', 'Site de Yamoussoukro', 1); -- ========================================== -- VERIFICATION DES TABLES CREEES -- ========================================== -- Vous pouvez exécuter ces requêtes pour vérifier : -- SELECT COUNT(*) FROM liaisons; -- SELECT COUNT(*) FROM sites; -- SELECT COUNT(*) FROM priority_levels; -- SELECT COUNT(*) FROM equipments;