<?php

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

class CreateHistoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('history', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->string('patients_id');
            $table->unsignedBigInteger('users_id');
            $table->string('title')->nullable();
            $table->text('summary');
            $table->string('especiality', 5);
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable();
            
            $table->foreign('especiality', 'FK_1b55528c769b3a0eec33b29dca8')->references('id')->on('especiality');
            $table->foreign('users_id', 'FK_1c63d2d8e9ea9e901934dba62cc')->references('id')->on('users');
            $table->foreign('patients_id', 'FK_8b4408487151fd28a73603214f5')->references('id')->on('patients');
        });
    }

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