<?php

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

class CreateEvaluateTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // *
        Schema::create('evaluates', function (Blueprint $table) {
            $table->id();
            $table->string('comment', 400);
            $table->string('evaluate_average', 5)->nullable();
//            $table->json('evaluate_details');
            $table->unsignedBigInteger('user_id');
            $table->unsignedBigInteger('hotel_id')->nullable();
            $table->unsignedBigInteger('umrah_trip_id')->nullable();
            $table->boolean('status')->default(0);

            $table->timestamps();
            $table->softDeletes();

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

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