<?php
include 'db.php';

echo "<h2>Starting Hero Slider Migration</h2>";

// Use standard SQL without IF NOT EXISTS for better compatibility
$sql = "ALTER TABLE games ADD COLUMN hero_video VARCHAR(255) DEFAULT NULL AFTER package_name";

try {
    if ($conn->query($sql)) {
        echo "<p style='color:green;'>SUCCESS: Added hero_video column to games table.</p>";
    } else {
        echo "<p style='color:red;'>ERROR: " . $conn->error . "</p>";
    }
} catch (Exception $e) {
    if (strpos($e->getMessage(), 'Duplicate column name') !== false) {
        echo "<p style='color:blue;'>NOTE: Column <code>hero_video</code> already exists.</p>";
    } else {
        echo "<p style='color:red;'>ERROR: " . $e->getMessage() . "</p>";
    }
}

echo "<h3>Migration Finished</h3>";
?>