<?php
require_once 'config/database.php';

try {
    $pdo->exec('ALTER TABLE admission_applications ADD COLUMN selected_subjects TEXT DEFAULT NULL');
    echo 'Column selected_subjects added successfully';
} catch (Exception $e) {
    // Check if column already exists
    if (strpos($e->getMessage(), 'Duplicate column name') !== false) {
        echo 'Column selected_subjects already exists';
    } else {
        echo 'Error: ' . $e->getMessage();
    }
}

// Clean up the file after execution
if (isset($_GET['cleanup'])) {
    unlink(__FILE__);
}
?>