<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('t_users', function (Blueprint $table) {
            $table->id();
            $table->string('first_name');
            $table->string('last_name')->nullable();
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->bigInteger('phone')->nullable();
            $table->tinyInteger('phone_code')->default(62);
            $table->string('password');
            $table->rememberToken();
            $table->integer('role')->comment('1=>su, 2=>admin, 3=>user')->default(2);
            $table->integer('status')->comment('1=>active, 2=>not_active, 3=>suspend')->default(1);
            $table->integer('is_login')->comment('1=>login,2=>logout')->default(2);
            $table->integer('crt');
            $table->integer('crt_by');
            $table->integer('updt');
            $table->integer('updt_by');
            $table->integer('dlt')->nullable();
            $table->integer('dlt_by')->nullable();
        });
    }

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