Files

42 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?php
/**
* 文件功能:创建部门表迁移
* 部门是职务的上级分类(办公厅 / 迎宾部 / 聊务部 / 宣传部等)
*
* @author ChatRoom Laravel
*
* @version 1.0.0
*/
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('departments', function (Blueprint $table) {
$table->id();
$table->string('name', 50)->comment('部门名称');
$table->unsignedTinyInteger('rank')->default(0)->comment('部门位阶(0~9999 最高)');
$table->string('color', 10)->nullable()->comment('展示颜色 hex(如 #8B0000');
$table->tinyInteger('sort_order')->default(0)->comment('后台列表排序');
$table->string('description', 255)->nullable()->comment('部门描述');
$table->timestamps();
});
}
/**
* 回滚:删除部门表
*/
public function down(): void
{
Schema::dropIfExists('departments');
}
};