12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?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('system_users', function (Blueprint $table) {
- $table->comment('用户信息表');
- $table->id()->comment('用户ID');
- $table->string('name')->unique()->comment('用户账号');
- $table->string('email')->nullable()->comment('用户邮箱');
- $table->timestamp('email_verified_at')->nullable()->comment('验证邮箱');
- $table->string('password')->comment('用户密码');
- $table->string('nickname')->nullable()->comment('用户昵称');
- $table->string('avatar')->nullable()->comment('用户头像');
- $table->string('mobile')->nullable()->comment('手机号码');
- $table->tinyInteger('sex')->default(0)->nullable()->comment('性别');
- $table->string('ip_address', 45)->nullable()->comment('最后登录IP');
- $table->timestamp('last_activity_at')->nullable()->comment('最后登录时间');
- $table->text('remark')->nullable()->comment('备注');
- $table->tinyInteger('status')->default(1)->comment('账户状态 (1正常 0停用)');
- $table->bigInteger('creator')->nullable()->comment('创建者');
- $table->bigInteger('updater')->nullable()->comment('更新者');
- $table->rememberToken();
- $table->timestamps();
- $table->softDeletes();
- });
- Schema::create('system_password_reset_tokens', function (Blueprint $table) {
- $table->string('name')->primary();
- $table->string('token');
- $table->timestamp('created_at')->nullable();
- });
- Schema::create('system_sessions', function (Blueprint $table) {
- $table->string('id')->primary();
- $table->foreignId('user_id')->nullable()->index();
- $table->string('ip_address', 45)->nullable();
- $table->text('user_agent')->nullable();
- $table->longText('payload');
- $table->integer('last_activity')->index();
- });
- }
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::dropIfExists('system_users');
- Schema::dropIfExists('system_password_reset_tokens');
- Schema::dropIfExists('system_sessions');
- }
- };
|