mirror of
https://devops.lemonos.cn/lawson/FendxPHP.git
synced 2026-06-15 23:12:49 +08:00
40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
|
|
<?php
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
use Fendx\Database\Schema\Schema;
|
||
|
|
use Fendx\Database\Migration;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 创建权限表
|
||
|
|
*/
|
||
|
|
class CreatePermissionsTable extends Migration
|
||
|
|
{
|
||
|
|
public function up(): void
|
||
|
|
{
|
||
|
|
Schema::create('permissions', function (Schema\Table $table) {
|
||
|
|
$table->id('id')->primary()->autoIncrement();
|
||
|
|
$table->string('name', 100)->unique()->comment('权限名称');
|
||
|
|
$table->string('display_name', 100)->comment('显示名称');
|
||
|
|
$table->text('description')->nullable()->comment('权限描述');
|
||
|
|
$table->string('guard_name', 50)->default('web')->comment('守卫名称');
|
||
|
|
$table->string('group_name', 50)->nullable()->comment('权限分组');
|
||
|
|
$table->boolean('is_active')->default(true)->comment('是否激活');
|
||
|
|
$table->integer('sort_order')->default(0)->comment('排序');
|
||
|
|
$table->timestamp('created_at')->useCurrent()->comment('创建时间');
|
||
|
|
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->comment('更新时间');
|
||
|
|
|
||
|
|
// 索引
|
||
|
|
$table->index('name');
|
||
|
|
$table->index('guard_name');
|
||
|
|
$table->index('group_name');
|
||
|
|
$table->index('is_active');
|
||
|
|
$table->index('sort_order');
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down(): void
|
||
|
|
{
|
||
|
|
Schema::dropIfExists('permissions');
|
||
|
|
}
|
||
|
|
}
|