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

// Add application_no field to students table if it doesn't exist
try {
    $pdo->exec("ALTER TABLE students ADD COLUMN application_no VARCHAR(50) DEFAULT NULL AFTER student_id");
    echo 'Application number field added to students table successfully.' . PHP_EOL;
} catch (Exception $e) {
    // Check if the error is because the column already exists
    if (strpos($e->getMessage(), 'Duplicate column name') !== false) {
        echo 'Application number field already exists in students table.' . PHP_EOL;
    } else {
        echo 'Error adding application number field: ' . $e->getMessage() . PHP_EOL;
    }
}
?>