<?php

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

class CreateAbrarPlanProjectHistoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('abrar_plan_project_histories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedSmallInteger('project_id');
            $table->foreign('project_id')
                ->references('id')
                ->on('abrar_plan_projects');
            $table->unsignedInteger('user_id');
            $table->foreign('user_id')
                ->references('id')
                ->on('users');
            $table->string('previous_type')->nullable();
            $table->unsignedTinyInteger('previous_status')->nullable();
            $table->string('previous_status_progress')->nullable();
            $table->text('previous_status_description')->nullable();
            $table->string('previous_status_date')->nullable();
            $table->string('previous_start_latlng')->nullable();
            $table->string('previous_end_latlng')->nullable();
            $table->string('previous_length')->nullable();
            $table->text('new_files')->nullable();
            $table->timestamps();
        });
    }

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