<?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('approval_nodes', function (Blueprint $table) {
            $table->string('node_label', 100)->nullable()->after('node_order')->comment('节点名称');
            $table->string('role', 50)->nullable()->after('node_label')->comment('节点角色标识');
            // approver_id 改为可空（无模板时无法预指定审批人）
            $table->unsignedBigInteger('approver_id')->nullable()->change();
        });
    }

    public function down(): void
    {
        Schema::table('approval_nodes', function (Blueprint $table) {
            $table->dropColumn(['node_label', 'role']);
        });
    }
};
