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

try {
    // Check if customer_no column exists in admission_applications table
    $stmt = $pdo->query("SHOW COLUMNS FROM admission_applications LIKE 'customer_no'");
    $column_exists = $stmt->fetch();

    if ($column_exists) {
        echo "Column customer_no already exists in admission_applications table.";
    } else {
        echo "Adding customer_no column to admission_applications table...";
        
        // Add the customer_no column to the table
        $pdo->exec("ALTER TABLE admission_applications ADD COLUMN customer_no VARCHAR(20) UNIQUE AFTER application_no");
        
        echo "Column customer_no added successfully to admission_applications table.";
    }
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
?>