<?php
/**
 * Upgrade: add target_total to service_types.
 *
 * target_total is the desired total attendance for that service type.
 */
require_once __DIR__ . '/../config/database.php';

try {
    $pdo->exec("ALTER TABLE service_types ADD COLUMN target_total INT NULL AFTER is_active");
    echo "Added column: service_types.target_total\n";
} catch (PDOException $e) {
    // 1060 = Duplicate column name
    if ((int)($e->errorInfo[1] ?? 0) === 1060) {
        echo "Column already exists: service_types.target_total\n";
    } else {
        echo "Error: " . $e->getMessage() . "\n";
        exit(1);
    }
}

echo "\nAttendance targets upgrade complete.\n";

