<?php

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

class CreateRoadObservedHistoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('road_observed_histories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('problem_id');
            $table->foreign('problem_id')
                ->references('id')
                ->on('road_observeds');
            $table->unsignedInteger('user_id');
            $table->foreign('user_id')
                ->references('id')
                ->on('users');
            $table->boolean('previous_rms_status')->default(0);
            $table->string('previous_rms_start_latlng')->nullable();
            $table->string('previous_rms_end_latlng')->nullable();
            $table->text('previous_rms_description')->nullable();
            $table->text('new_files')->nullable();
            $table->timestamps();
        });
    }

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