<?php

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

class CreateRelationshipTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('relationship', function (Blueprint $table) {
            $table->string('representative_id');
            $table->string('patients_id');
            $table->string('title', 45);
            $table->string('description', 45)->nullable();
            $table->timestamp('created_at')->useCurrent();
            $table->string('updated_at', 45)->nullable();
            
            $table->primary(['representative_id', 'patients_id']);
            $table->foreign('representative_id', 'FK_887dc23b272d72479a1c2705a40')->references('id')->on('representative');
            $table->foreign('patients_id', 'FK_989e473baf6ba5a2af9c1efddd6')->references('id')->on('patients');
        });
    }

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