<?php

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

class CreateAccidentPointHistoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('accident_point_histories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedSmallInteger('point_id');
            $table->foreign('point_id')
                ->references('id')
                ->on('accident_points');
            $table->unsignedInteger('user_id');
            $table->foreign('user_id')
                ->references('id')
                ->on('users');
            $table->string('previous_lat');
            $table->string('previous_lng');
            $table->text('previous_operation')->nullable();
            $table->string('previous_target')->nullable();
            $table->string('previous_cost')->nullable();
            $table->string('previous_progress')->nullable();
            $table->string('previous_end_date')->nullable();
            $table->text('previous_actions')->nullable();
            $table->text('new_files')->nullable();
            $table->timestamps();
        });
    }

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