Réparation de la base de données"; try { $pdo = db(); } catch (Exception $e) { die("
Erreur de connexion : " . $e->getMessage() . "
"); } $tables = [ "CREATE TABLE IF NOT EXISTS `channel_events` ( `id` int(11) NOT NULL AUTO_INCREMENT, `channel_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `title` varchar(255) NOT NULL, `description` text DEFAULT NULL, `banner_url` varchar(255) DEFAULT NULL, `banner_color` varchar(20) DEFAULT NULL, `start_date` date NOT NULL, `start_time` time NOT NULL, `end_date` date NOT NULL, `end_time` time NOT NULL, `frequency` varchar(50) DEFAULT NULL, `is_permanent` tinyint(1) DEFAULT 0, `created_at` timestamp NULL DEFAULT current_timestamp(), `enable_reactions` tinyint(1) DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", "CREATE TABLE IF NOT EXISTS `poll_votes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `message_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `option_index` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", "CREATE TABLE IF NOT EXISTS `server_badges` ( `id` int(11) NOT NULL AUTO_INCREMENT, `server_id` int(11) NOT NULL, `name` varchar(255) NOT NULL, `image_url` text NOT NULL, `created_at` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", "CREATE TABLE IF NOT EXISTS `member_badges` ( `server_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `badge_id` int(11) NOT NULL, PRIMARY KEY (`server_id`,`user_id`,`badge_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;", "CREATE TABLE IF NOT EXISTS `event_participations` ( `id` int(11) NOT NULL AUTO_INCREMENT, `event_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `event_id` (`event_id`,`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;" ]; foreach ($tables as $sql) { try { $pdo->exec($sql); echo "✅ Exécution réussie d'une requête de création.
"; } catch (Exception $e) { echo "⚠️ Info : " . $e->getMessage() . " (Peut-être que la table existe déjà)
"; } } echo "✅ Mise à jour des colonnes 'channels' terminée.
"; } catch (Exception $e) { echo "ℹ️ Colonnes déjà présentes dans 'channels'.
"; } echo "Terminé ! Essayez de rafraîchir votre page index.php.
"; echo "IMPORTANT : Supprimez ce fichier (fix_db.php) après usage.
";