<?php

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

class CreateWorkWayDescriptionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('work_way_descriptions', function (Blueprint $table) {
            $table->id();
            $table->string('title', 100);
            $table->string('description', 400);

            $table->unsignedBigInteger('work_way_id');
            $table->unsignedBigInteger('language_id');

            $table->foreign('work_way_id')->references('id')->on('work_ways')->onDelete('cascade');


            $table->index(['work_way_id', 'language_id']);
            $table->engine = 'InnoDB';
        });
    }

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