<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username')->unique();
            $table->string('password');
            $table->string('name')->nullable();
            $table->string('first_name', 100)->nullable();
            $table->string('last_name', 100)->nullable();
            $table->string('email')->nullable();
            $table->char('mobile', 11)->nullable();
            $table->string('position')->nullable();
            $table->string('major', 200)->nullable();
            $table->string('degree')->nullable();
            $table->unsignedTinyInteger('province_id')->nullable()->index('users_province_id_foreign');
            $table->string('province_fa')->nullable();
            $table->integer('setad_id')->nullable();
            $table->unsignedSmallInteger('city_id')->nullable()->index('users_city_id_foreign');
            $table->string('city_fa')->nullable();
            $table->string('photo')->nullable();
            $table->rememberToken();
            $table->boolean('confirmed')->default(false);
            $table->boolean('enabled')->default(true);
            $table->string('avatar')->nullable();
            $table->timestamps();
            $table->tinyInteger('checked')->nullable()->default(0);
            $table->unsignedBigInteger('edarate_shahri_id')->nullable()->index('users_edarate_shahri_id_foreign');
            $table->string('edarate_shahri_name', 100)->nullable();
            $table->unsignedBigInteger('edarate_ostani_id')->nullable()->index('users_edarate_ostani_id_foreign');
            $table->string('edarate_ostani_name', 100)->nullable();
            $table->string('national_code', 10)->nullable();
            $table->dateTime('last_login')->nullable();
        });
    }

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