<?php
require_once __DIR__ . '/../db_config.php';

// Check if columns already exist
$checkColumns = $conn->query("SHOW COLUMNS FROM blogs LIKE 'image_orientation'");
if ($checkColumns && $checkColumns->num_rows > 0) {
    echo "Columns already exist. Skipping migration.\n";
    exit;
}

// Add columns
$sql = "ALTER TABLE blogs 
ADD COLUMN image_orientation ENUM('landscape', 'portrait', 'square') DEFAULT 'landscape' AFTER featured_image,
ADD COLUMN image_size ENUM('small', 'medium', 'large') DEFAULT 'medium' AFTER image_orientation";

if ($conn->query($sql)) {
    echo "Migration successful! Added image_orientation and image_size columns.\n";
} else {
    echo "Error: " . $conn->error . "\n";
}
