<?php

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

class CreateHotelDescriptionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('hotel_descriptions', function (Blueprint $table) {
            $table->id();
            $table->string('name', 100);
            $table->string('address', 200)->nullable();

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

            $table->foreign('hotel_id')->references('id')->on('hotels')->onDelete('cascade');

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

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