<?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('users', function (Blueprint $table) {
            $table->increments('id');
            $table->uuid('uuid')->unique('uuid');
            $table->char('pid', 32)->index('pid');
            $table->dateTime('created_at');
            $table->uuid('created_uuid')->index('created_uuid');
            $table->dateTime('updated_at');
            $table->uuid('updated_uuid')->index('updated_uuid');
            $table->dateTime('registered_at');
            $table->string('registered_ip', 255);
            $table->dateTime('lastactive_at');
            $table->string('lastactive_ip', 255);
            $table->string('username', 255)->unique('username');
            $table->text('email_hashed')->unique('email_hashed');
            $table->text('email_encrypted');
            $table->string('password', 255);
            $table->rememberToken();
        });
    }

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