<?php
// Enable error reporting for debugging
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Include database configuration
require_once 'config/database.php';
// Check if the has_dues column already exists in enrollments table
$check_column_query = "SHOW COLUMNS FROM enrollments LIKE 'has_dues'";
$check_result = $conn->query($check_column_query);
if ($check_result->num_rows == 0) {
// Column doesn't exist, add it
$add_column_query = "ALTER TABLE enrollments ADD COLUMN has_dues TINYINT(1) NOT NULL DEFAULT 0 AFTER status";
if ($conn->query($add_column_query)) {
echo "<div style='background-color: #d4edda; color: #155724; padding: 15px; border-radius: 5px; margin-bottom: 20px;'>";
echo "<h4>Success!</h4>";
echo "<p>The has_dues column has been added to the enrollments table successfully.</p>";
echo "</div>";
} else {
echo "<div style='background-color: #f8d7da; color: #721c24; padding: 15px; border-radius: 5px; margin-bottom: 20px;'>";
echo "<h4>Error</h4>";
echo "<p>Error adding has_dues column: " . $conn->error . "</p>";
echo "</div>";
}
} else {
echo "<div style='background-color: #d4edda; color: #155724; padding: 15px; border-radius: 5px; margin-bottom: 20px;'>";
echo "<h4>Information</h4>";
echo "<p>The has_dues column already exists in the enrollments table.</p>";
echo "</div>";
}
?>