<?php

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

class CreateStaffDescriptionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('staff_descriptions', function (Blueprint $table) {
            $table->id();
            $table->string('name', 100);
            $table->string('job_title', 100);
            $table->string('description', 500);
            $table->text('brief');
            $table->longText('practical_experience');
            $table->longText('scientific_expertise');
            $table->unsignedBigInteger('staff_id');
            $table->unsignedBigInteger('language_id');

            $table->foreign('staff_id')->references('id')->on('staffs')->onDelete('cascade');
            $table->foreign('language_id')->references('id')->on('languages')->onDelete('cascade');
            $table->index(['staff_id', 'language_id']);
            $table->engine = 'InnoDB';
        });
    }

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