<?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->boolean('status')->default(0);

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

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

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