<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('team_id')->default(0)->comment('归属于哪个团队');
            $table->string('username', 50);
            $table->string('name');
            $table->string('icon')->nullable()->comment('头像');
            $table->string('email')->unique();
            $table->string('phone')->unique()->nullable();
            $table->string('password', 60);
            $table->string('position')->nullable()->comment('职位');
            $table->string('address')->nullable()->comment('地址');
            $table->boolean('is_team')->default(0)->comment('是否团队人员');
            $table->boolean('is_manager')->default(0)->comment('是否团队管理员');
            $table->unsignedTinyInteger('status')->default(1)->comment('状态 1 启用 2 冻结');
            $table->text('inquiry_permissions')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });
    }

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