<?php

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

class CreateRoadConstructionProjectsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('road_construction_projects', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedInteger('user_id');
            $table->foreign('user_id')
                ->references('id')
                ->on('users');
            $table->unsignedTinyInteger('operation_type');
            $table->string('operation_sub_types');
            $table->decimal('start_lat', 12, 10);
            $table->decimal('start_lng', 12, 10);
            $table->decimal('end_lat', 12, 10);
            $table->decimal('end_lng', 12, 10);
            $table->string('project_distance');
            $table->unsignedTinyInteger('province');
            $table->unsignedTinyInteger('city');
            $table->string('axis_name')->nullable();
            $table->unsignedTinyInteger('axis_type');
            $table->string('project_name')->nullable();
            $table->unsignedTinyInteger('project_type');
            $table->string('start_date')->nullable();
            $table->string('consultant_name')->nullable();
            $table->string('contractor_name')->nullable();
            $table->string('ordered_credit');
            $table->string('absorbed_credit');
            $table->string('required_credit')->nullable();
            $table->string('plan_number')->nullable();
            $table->unsignedTinyInteger('plan_office')->nullable();
            $table->string('announced_date')->nullable();
            $table->string('credit_progress');
            $table->string('physical_progress');
            $table->text('project_problems')->nullable();
            $table->unsignedTinyInteger('project_status');
            $table->string('project_stop_reasons')->nullable();
            $table->boolean('can_release')->default(0);
            $table->string('release_date')->nullable();
            $table->string('supervisor_name')->nullable();
            $table->string('responsible_name')->nullable();
            $table->string('report_date')->nullable();
            $table->timestamps();
        });
    }

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