<?php
require_once __DIR__ . '/config.php';
$db = db();

try {
    $cols = $db->query("DESCRIBE factions")->fetchAll(PDO::FETCH_COLUMN);
    if (!in_array('fa_icon', $cols)) {
        $db->exec("ALTER TABLE factions ADD COLUMN fa_icon VARCHAR(50) NULL AFTER image_url");
        echo "Column 'fa_icon' added to 'factions' table.\n";
    } else {
        echo "Column 'fa_icon' already exists in 'factions' table.\n";
    }
} catch (PDOException $e) {
    die("Migration failed: " . $e->getMessage());
}

