<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

/**
 * Documents the new 'pending_calibration' status value.
 * The status column is VARCHAR so no schema change needed —
 * this migration updates any 'unknown' status rows that have
 * a detected platform but no current_version.
 */
return new class extends Migration
{
    public function up(): void
    {
        DB::table('modpackchecker_servers')
            ->where('status', 'unknown')
            ->whereNotNull('platform')
            ->whereNull('current_version')
            ->update(['status' => 'pending_calibration']);
    }

    public function down(): void
    {
        DB::table('modpackchecker_servers')
            ->where('status', 'pending_calibration')
            ->update(['status' => 'unknown']);
    }
};
