<?php

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

class CreateUserProfileTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_profile', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->unsignedBigInteger('users_id');
            $table->string('identification')->unique('user_profile_identification_unique');
            $table->string('firstname', 45);
            $table->string('lastname', 45);
            $table->string('age', 45);
            $table->enum('gender', ['f', 'm', 'o']);
            $table->string('email', 45)->nullable();
            $table->string('phone', 45);
            $table->text('address');
            $table->dateTime('birthday')->nullable();
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable();
            
            $table->foreign('users_id', 'FK_52d9647ed16d8c21f894664695e')->references('id')->on('users');
        });
    }

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