<?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::create('menus', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('parent_id')->default(0)->comment('上级菜单');
            $table->string('name', 50)->comment('菜单名称');
            $table->string('path', 255)->nullable()->comment('路由路径');
            $table->string('component', 255)->nullable()->comment('组件路径');
            $table->string('icon', 50)->nullable()->comment('图标');
            $table->string('permission_code', 100)->nullable()->comment('关联权限标识');
            $table->tinyInteger('type')->default(1)->comment('1目录 2菜单 3按钮');
            $table->tinyInteger('visible')->default(1)->comment('1显示 0隐藏');
            $table->integer('sort')->default(0);
            $table->tinyInteger('status')->default(1)->comment('1启用 0停用');
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('menus');
    }
};
