<?php
include 'includes/db.php';

// Add session and academic_year columns to users table
$columns = [
    'session' => "VARCHAR(20) DEFAULT 'Fall'",
    'academic_year' => "VARCHAR(20) DEFAULT '2024'"
];

foreach ($columns as $col => $def) {
    $check = $conn->query("SHOW COLUMNS FROM users LIKE '$col'");
    if ($check->num_rows == 0) {
        $sql = "ALTER TABLE users ADD COLUMN $col $def";
        if ($conn->query($sql) === TRUE) {
            echo "Column '$col' added successfully.<br>";
        } else {
            echo "Error adding column '$col': " . $conn->error . "<br>";
        }
    } else {
        echo "Column '$col' already exists.<br>";
    }
}
?>
