<?php

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

class CreateUserProfileHasEspecialityTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_profile_has_especiality', function (Blueprint $table) {
            $table->string('user_profile_id');
            $table->string('especiality_id', 5);
            
            $table->primary(['user_profile_id', 'especiality_id']);
            $table->foreign('user_profile_id', 'FK_10bf582da6a42d7c8b451258a79')->references('id')->on('user_profile');
            $table->foreign('especiality_id', 'FK_6668f7b5072d15594f19cfe4941')->references('id')->on('especiality')->onDelete('cascade')->onUpdate('cascade');
        });
    }

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