Lae/database/migrations/2014_10_12_000000_create_users_table.php

48 lines
1.6 KiB
PHP
Raw Normal View History

2022-08-12 07:56:56 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
2023-01-30 16:14:07 +00:00
return new class extends Migration
{
2022-08-12 07:56:56 +00:00
/**
* Run the migrations.
*
* @return void
*/
2023-01-14 10:02:27 +00:00
public function up(): void
2022-08-12 07:56:56 +00:00
{
Schema::create('users', function (Blueprint $table) {
$table->id();
2023-02-02 12:11:41 +00:00
$table->uuid()->nullable()->unique();
$table->string('name')->index();
$table->string('real_name')->nullable();
2022-08-12 07:56:56 +00:00
$table->string('email')->unique();
2023-02-02 12:11:41 +00:00
$table->string('email_md5')->nullable()->comment('邮箱 MD5');
$table->string('id_card')->nullable()->comment('身份证号');
2022-08-12 07:56:56 +00:00
$table->timestamp('email_verified_at')->nullable();
2023-02-02 12:11:41 +00:00
$table->timestamp('real_name_verified_at')->nullable()->index()->comment('实名认证时间');
$table->date('birthday_at')->nullable()->index();
2022-08-12 07:56:56 +00:00
$table->string('password')->nullable();
2023-02-02 12:11:41 +00:00
$table->decimal('balance', 20, 4)->default(0);
$table->dateTime('banned_at')->nullable()->index()->comment('封禁时间');
$table->string('banned_reason')->nullable();
$table->unsignedBigInteger('user_group_id')->nullable()->index()->comment('用户组');
2022-08-12 07:56:56 +00:00
$table->rememberToken();
$table->timestamps();
2023-02-02 12:11:41 +00:00
$table->softDeletes();
2022-08-12 07:56:56 +00:00
});
}
/**
* Reverse the migrations.
*
* @return void
*/
2023-01-14 10:02:27 +00:00
public function down(): void
2022-08-12 07:56:56 +00:00
{
Schema::dropIfExists('users');
}
};