mirror of
https://devops.lemonos.cn/lawson/FendxPHP.git
synced 2026-06-15 23:12:49 +08:00
feat(database): 添加用户角色权限系统及相关监控功能
- 创建用户表(users)包含基本信息和认证字段 - 创建角色表(roles)用于权限控制 - 创建权限表(permissions)定义系统权限 - 创建用户角色关联表(user_roles)建立用户与角色关系 - 创建角色权限关联表(role_permissions)建立角色与权限关系 - 创建迁移记录表(migrations)追踪数据库变更 - 添加AdminController提供管理员面板功能 - 实现系统监控、配置管理、缓存清理等功能 - 添加AOP切面编程支持的各种通知类型 - 实现告警管理AlertManager支持多渠道告警 - 添加文档注解接口规范
This commit is contained in:
48
database/migrations/2024_01_15_000001_create_users_table.php
Normal file
48
database/migrations/2024_01_15_000001_create_users_table.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Fendx\Database\Schema\Schema;
|
||||
use Fendx\Database\Migration;
|
||||
|
||||
/**
|
||||
* 创建用户表
|
||||
*/
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Schema\Table $table) {
|
||||
$table->id('id')->primary()->autoIncrement();
|
||||
$table->string('username', 50)->unique()->comment('用户名');
|
||||
$table->string('email', 100)->unique()->comment('邮箱');
|
||||
$table->string('password', 255)->comment('密码');
|
||||
$table->string('nickname', 50)->nullable()->comment('昵称');
|
||||
$table->string('avatar', 255)->nullable()->comment('头像');
|
||||
$table->string('phone', 20)->nullable()->comment('手机号');
|
||||
$table->enum('gender', ['male', 'female', 'other'])->nullable()->comment('性别');
|
||||
$table->date('birthday')->nullable()->comment('生日');
|
||||
$table->text('bio')->nullable()->comment('个人简介');
|
||||
$table->string('status', 20)->default('active')->comment('状态: active, inactive, banned');
|
||||
$table->boolean('email_verified')->default(false)->comment('邮箱是否验证');
|
||||
$table->boolean('phone_verified')->default(false)->comment('手机是否验证');
|
||||
$table->timestamp('email_verified_at')->nullable()->comment('邮箱验证时间');
|
||||
$table->timestamp('phone_verified_at')->nullable()->comment('手机验证时间');
|
||||
$table->timestamp('last_login_at')->nullable()->comment('最后登录时间');
|
||||
$table->string('last_login_ip', 45)->nullable()->comment('最后登录IP');
|
||||
$table->timestamp('created_at')->useCurrent()->comment('创建时间');
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->comment('更新时间');
|
||||
|
||||
// 索引
|
||||
$table->index('username');
|
||||
$table->index('email');
|
||||
$table->index('status');
|
||||
$table->index('created_at');
|
||||
$table->index('last_login_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user