<?php

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

class CreateControlHistoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('control_history', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->string('history_id');
            $table->unsignedBigInteger('users_id');
            $table->string('especiality', 5);
            $table->string('title', 45)->nullable();
            $table->text('summary')->nullable();
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable();
            
            $table->foreign('history_id', 'FK_5d4fd9599195a6178cee4bf7095')->references('id')->on('history');
            $table->foreign('especiality', 'FK_7430f6b836f443a31f14acc1113')->references('id')->on('especiality');
            $table->foreign('users_id', 'FK_ae3b6351927c18ab5e6dc42fc42')->references('id')->on('users');
        });
    }

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