<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * Which building, not which city.
 *
 * `code` and `name` say Falkenstein. They do not say WHICH datacenter in
 * Falkenstein — and a provider runs several within one location (fsn-dc-15,
 * fsn-dc-18), on separate power and separate uplinks. Two hosts placed "in fsn"
 * may sit in the same hall or ten minutes apart, which is the whole question
 * anyone asks when placing a second machine for redundancy.
 *
 * Deliberately free text and deliberately optional: it is the provider's label,
 * it changes when they rename their halls, and nothing in the system is allowed
 * to key off it. `code` remains the identifier — this only has to be readable.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('datacenters', function (Blueprint $table) {
            $table->string('facility')->nullable()->after('name');
        });
    }

    public function down(): void
    {
        Schema::table('datacenters', function (Blueprint $table) {
            $table->dropColumn('facility');
        });
    }
};
