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

// Direct database update to add customer_no column
try {
    // Check if the customer_no column exists
    $checkQuery = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS 
                   WHERE TABLE_NAME = 'admission_applications' 
                   AND COLUMN_NAME = 'customer_no'";
    $result = $pdo->query($checkQuery);
    
    if ($result->rowCount() == 0) {
        // Column doesn't exist, so add it
        $alterQuery = "ALTER TABLE admission_applications 
                       ADD COLUMN customer_no VARCHAR(20) UNIQUE AFTER application_no";
        $pdo->exec($alterQuery);
        echo "SUCCESS: customer_no column added to admission_applications table.";
    } else {
        echo "INFO: customer_no column already exists in admission_applications table.";
    }
} catch (Exception $e) {
    echo "ERROR: " . $e->getMessage();
}
?>