<?php
require_once 'auth.php';
require_once __DIR__ . '/../includes/pdo.php';

echo "<h2>🔧 SEO Database Update</h2>";

try {
    // Add seo_keywords to city_service table
    $column = 'seo_keywords';
    $definition = "TEXT NULL";
    
    $check = $pdo->query("SHOW COLUMNS FROM city_service LIKE '$column'");
    if ($check->rowCount() == 0) {
        $pdo->exec("ALTER TABLE city_service ADD COLUMN $column $definition");
        echo "<p style='color: green;'>✅ Added column: <strong>$column</strong></p>";
    } else {
        echo "<p style='color: #666;'>ℹ️ Column <strong>$column</strong> already exists.</p>";
    }

    echo "<hr><h3>🎉 SEO database updates completed!</h3>";
    echo "<p><a href='modern-ai-content.php' style='padding: 10px 20px; background: #667eea; color: white; text-decoration: none; border-radius: 5px;'>Back to Dashboard</a></p>";

} catch (PDOException $e) {
    die("<p style='color: red;'>❌ Error: " . htmlspecialchars($e->getMessage()) . "</p>");
}
?>
