<?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('roles', function (Blueprint $table)
        {
            $table->string('description')->nullable()->after('name');
            $table->string('color')->nullable()->after('description');
        });

        Schema::table('permissions', function (Blueprint $table)
        {
            $table->string('group')->after('name');
            $table->string('label')->after('group');
            $table->text('description')->nullable()->after('label');
        });
    }

    public function down(): void {
        Schema::table('roles', function (Blueprint $table)
        {
            $table->dropColumn('description');
            $table->dropColumn('color');
        });

        Schema::table('permissions', function (Blueprint $table)
        {
            $table->dropColumn('group');
            $table->dropColumn('label');
            $table->dropColumn('description');
        });
    }
};
