<?php

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

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

            $table->unsignedBigInteger('case_update_id')->index();
            $table->unsignedBigInteger('language_id')->index();
            $table->foreign('case_update_id')->references('id')->on('case_updates')->onDelete('cascade')->onUpdate('cascade');
            $table->foreign('language_id')->references('id')->on('languages')->onDelete('cascade')->onUpdate('cascade');

            $table->engine = 'InnoDB';
        });
    }

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