<?php
require_once __DIR__ . '/../app/core/bootstrap.php';
$pdo = crm_pdo();
try {
    $pdo->exec("ALTER TABLE projects ADD COLUMN distance_km DECIMAL(10,2) DEFAULT NULL AFTER longitude");
    echo "OK: distance_km column added.";
} catch (PDOException $e) {
    if (strpos($e->getMessage(), 'Duplicate column name') !== false) {
        echo "OK: column already exists.";
    } else {
        echo "ERROR: " . $e->getMessage();
    }
}
