<?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('managed_environments', function (Blueprint $table) {
            $table->string('rbac_status')->nullable()->after('rbac_scope_id');
            $table->string('rbac_status_reason')->nullable()->after('rbac_status');
            $table->timestamp('rbac_last_checked_at')->nullable()->after('rbac_status_reason');
        });
    }

    public function down(): void
    {
        Schema::table('managed_environments', function (Blueprint $table) {
            $table->dropColumn([
                'rbac_status',
                'rbac_status_reason',
                'rbac_last_checked_at',
            ]);
        });
    }
};
