<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMemberUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('member_user', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('mobile')->nullable()->comment('手机号');
            $table->string('password')->default('')->comment('密码');
            $table->tinyInteger('status')->default('0')->comment('状态 (0正常 1停用)');
            $table->string('register_ip')->nullable()->comment('注册IP');
            $table->tinyInteger('register_terminal')->nullable()->comment('注册终端');
            $table->string('login_ip')->nullable()->comment('最后登录IP');
            $table->timestamp('login_date')->nullable()->comment('最后登录时间');
            $table->string('openid')->nullable()->comment('微信ID');
            $table->integer('balance')->default('0')->comment('余额');
            $table->string('nickname')->nullable()->comment('用户昵称');
            $table->string('avatar')->nullable()->comment('用户头像');
            $table->string('name')->nullable()->comment('用户姓名');
            $table->tinyInteger('sex')->default('0')->nullable()->comment('用户性别');
            $table->bigInteger('area_id')->nullable()->comment('所在地');
            $table->timestamp('birthday')->nullable()->comment('出生日期');
            $table->string('mark')->nullable()->comment('会员备注');
            $table->integer('point')->default('0')->comment('用户积分');
            $table->string('tag_ids')->nullable()->comment('用户标签编号列表，以逗号分隔');
            $table->bigInteger('level_id')->nullable()->comment('等级编号');
            $table->integer('experience')->default('0')->comment('用户经验');
            $table->bigInteger('group_id')->nullable()->comment('用户分组');
            $table->string('creator')->nullable()->comment('创建者');
            $table->string('updater')->nullable()->comment('更新者');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('member_user');
    }
}
