<?php
require_once __DIR__ . '/../../db/config.php';

try {
    $pdo = db();
    $sql = "ALTER TABLE calendar_events DROP COLUMN type;";
    $pdo->exec($sql);
    echo "Migration 007 completed successfully: Dropped 'type' column from calendar_events.\n";
} catch (PDOException $e) {
    // Check if the column has already been dropped
    if (strpos($e->getMessage(), 'column not found') !== false || strpos($e->getMessage(), 'Unknown column') !== false) {
        echo "Migration 007 seems to be already applied (Column not found). Skipping.\n";
    } else {
        die("Migration 007 failed: " . $e->getMessage() . "\n");
    }
}

