<?php
require 'db.php';

try {
    $columns = $pdo->query("SHOW COLUMNS FROM rooms LIKE 'bot_active'")->fetchAll();
    if (empty($columns)) {
        $pdo->exec("ALTER TABLE rooms ADD COLUMN bot_active TINYINT(1) DEFAULT 0");
        echo "Added bot_active column to rooms table.<br>";
    } else {
        echo "bot_active column already exists.<br>";
    }
    echo "Database update complete.";
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}
?>
