<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('ssh_credentials', function (Blueprint $table) {
            // Human label so an operator can tell what an access is for.
            $table->string('name')->nullable()->after('server_id');
            // Soft "sperren": a disabled credential is kept but refused by the vault.
            $table->timestamp('disabled_at')->nullable()->after('passphrase');
            $table->timestamp('last_used_at')->nullable()->after('disabled_at');
        });
    }

    public function down(): void
    {
        Schema::table('ssh_credentials', function (Blueprint $table) {
            $table->dropColumn(['name', 'disabled_at', 'last_used_at']);
        });
    }
};
