<?php
/**
 * Migration script to add header_image column to events table
 */

require_once 'config.php';

$conn = getDBConnection();

// Check if column already exists
$check_sql = "SHOW COLUMNS FROM `events` LIKE 'header_image'";
$result = $conn->query($check_sql);

if ($result->num_rows === 0) {
    // Column doesn't exist, add it
    $sql = "ALTER TABLE `events` ADD COLUMN `header_image` VARCHAR(255) NULL AFTER `programme_filename`";
    
    if ($conn->query($sql) === TRUE) {
        echo "Column 'header_image' added successfully.<br>";
    } else {
        echo "Error adding column: " . $conn->error . "<br>";
    }
} else {
    echo "Column 'header_image' already exists.<br>";
}

$conn->close();
echo "Migration completed!<br>";
?>

