composer require --dev kitloong/laravel-migrations-generator php artisan migrate:generate
34 lines
919 B
PHP
34 lines
919 B
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('roles', function (Blueprint $table) {
|
|
$table->bigIncrements('id')->comment('PK: 역할 ID');
|
|
$table->unsignedBigInteger('tenant_id')->index();
|
|
$table->string('name', 50)->comment('역할명');
|
|
$table->string('description')->nullable()->comment('설명');
|
|
$table->timestamps();
|
|
$table->softDeletes()->comment('삭제일시(소프트삭제)');
|
|
|
|
$table->unique(['tenant_id', 'name'], 'uk_roles_tenant_name');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('roles');
|
|
}
|
|
};
|