-- Script pour créer les tables de référentiels si elles n'existent pas -- Table pour les localisations CREATE TABLE IF NOT EXISTS `locations` ( `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; -- Table pour les liaisons 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; -- Table pour les sites 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; -- Table pour les causes d'incidents CREATE TABLE IF NOT EXISTS `incident_causes` ( `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; -- Table pour les niveaux de priorité 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; -- Table pour les équipements 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; -- Données d'exemple pour les priorités 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 d'exemple pour les causes INSERT IGNORE INTO `incident_causes` (`name`, `category`, `description`, `active`) VALUES ('Panne de courant', 'Environnementale', 'Coupure d\'électricité', 1), ('Défaillance matérielle', 'Technique', 'Panne d\'équipement', 1), ('Erreur humaine', 'Humaine', 'Erreur de manipulation', 1), ('Problème réseau', 'Réseau', 'Dysfonctionnement du réseau', 1), ('Surcharge système', 'Système', 'Système surchargé', 1), ('Faille de sécurité', 'Sécurité', 'Problème de sécurité informatique', 1); -- Données d'exemple pour les équipements 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 d'exemple pour les localisations INSERT IGNORE INTO `locations` (`name`, `description`, `active`) VALUES ('Siège social', 'Bâtiment principal de l\'entreprise', 1), ('Data Center', 'Centre de données', 1), ('Site distant A', 'Premier site distant', 1), ('Site distant B', 'Deuxième site distant', 1); -- Données d'exemple pour les 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 d'exemple pour les 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);