<?php

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

class CreateScreenDescriptionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('screen_descriptions', function (Blueprint $table) {
            $table->id();
            $table->string('first_title', 100);
            $table->text('first_description');
            $table->string('second_title', 100);
            $table->text('second_description');
            $table->string('third_title', 100);
            $table->text('third_description');

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

            $table->foreign('screen_id')->references('id')->on('screens')->onDelete('cascade');

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

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