<?php

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

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

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

            $table->foreign('partner_detail_id')->references('id')->on('partner_details')->onDelete('cascade');

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

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