<?php

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

class CreateFaqsLang extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('faqs_lang', function (Blueprint $table) {
            $table->bigIncrements('translation_id');
            $table->unsignedBigInteger('faq_id');
            $table->string('language_id', 10);
            $table->string('title', 300);
            $table->text('content');

            // Languages
            $table->unique(['faq_id', 'language_id'], 'idx_faqs_lang');
            $table->foreign('faq_id')
                ->references('id')
                ->on('faqs')
                ->onDelete('CASCADE')
                ->onUpdate('CASCADE');
        });
    }

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

}
