composer require --dev kitloong/laravel-migrations-generator php artisan migrate:generate
38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('menus', function (Blueprint $table) {
|
|
$table->bigIncrements('id')->comment('PK: 메뉴 ID');
|
|
$table->unsignedBigInteger('tenant_id')->nullable()->index()->comment('FK: 테넌트 ID(null=공용메뉴)');
|
|
$table->unsignedBigInteger('parent_id')->nullable()->index()->comment('상위 메뉴 ID');
|
|
$table->string('name', 100)->comment('메뉴명');
|
|
$table->string('url')->nullable()->comment('메뉴 URL');
|
|
$table->boolean('is_active')->default(true)->comment('활성여부(1=활성,0=비활성)');
|
|
$table->integer('sort_order')->default(0)->comment('정렬순서');
|
|
$table->boolean('hidden')->default(false)->comment('숨김여부');
|
|
$table->boolean('is_external')->default(false)->comment('외부링크여부');
|
|
$table->string('external_url')->nullable()->comment('외부링크 URL');
|
|
$table->string('icon', 50)->nullable()->comment('아이콘명');
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('menus');
|
|
}
|
|
};
|