<?php

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

class CreateSectionDescriptionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('section_descriptions', function (Blueprint $table) {
            $table->id();
            $table->string('name', 100);
//            $table->string('keywords', 100)->nullable();
//            $table->string('meta_description', 100)->nullable();
//            $table->text('description')->nullable();

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

            $table->foreign('section_id')->references('id')->on('sections')->onDelete('cascade');

            $table->index(['section_id', 'language_id']);


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

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