<?php
require_once 'lomba/db.php';

// Check if column exists
$check = $mysqli->query("SHOW COLUMNS FROM users LIKE 'color_blindness_type'");
if ($check->num_rows == 0) {
    if ($mysqli->query("ALTER TABLE users ADD COLUMN color_blindness_type VARCHAR(50) DEFAULT 'none'") === TRUE) {
        echo "Column color_blindness_type added.\n";
    } else {
        echo "Error adding color_blindness_type: " . $mysqli->error . "\n";
    }
} else {
    echo "Column color_blindness_type already exists.\n";
}

$check2 = $mysqli->query("SHOW COLUMNS FROM users LIKE 'color_blindness_enabled'");
if ($check2->num_rows == 0) {
    if ($mysqli->query("ALTER TABLE users ADD COLUMN color_blindness_enabled TINYINT(1) DEFAULT 0") === TRUE) {
        echo "Column color_blindness_enabled added.\n";
    } else {
        echo "Error adding color_blindness_enabled: " . $mysqli->error . "\n";
    }
} else {
    echo "Column color_blindness_enabled already exists.\n";
}
?>
