<?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->longText('terms_conditions_description');
            $table->longText('privacy_policy_description');
            $table->longText('privacy_policy_description_list');

            $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');
    }
}
