<?php

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

class CreatePolicyDescriptionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('policy_descriptions', function (Blueprint $table) {
            $table->id();
            $table->string('disclaimer_title', 100);
            $table->string('terms_condition_title', 100);
            $table->text('terms_condition_description');
            $table->text('disclaimer_description');


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

            $table->foreign('policy_id')->references('id')->on('policies')->onDelete('cascade');

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

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