<?php

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

class CreateRoadConstructionRuralsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('road_construction_rurals', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedInteger('user_id');
            $table->foreign('user_id')
                ->references('id')
                ->on('users');
            $table->string('axis_name')->nullable();
            $table->unsignedTinyInteger('axis_type')->nullable();
            $table->string('project_name')->nullable();
            $table->unsignedTinyInteger('province_id')->nullable();
            $table->foreign('province_id')
                ->references('id')
                ->on('provinces');
            $table->json('cities_id')->nullable();
            $table->string('contractor_name')->nullable();
            $table->string('consultant_name')->nullable();
            $table->string('contract_date')->nullable();
            $table->string('contract_credit')->nullable();
            $table->string('start_latlng')->nullable();
            $table->string('end_latlng')->nullable();
            $table->timestamp('submited_at', 0)->nullable();
            $table->timestamp('last_updated_at', 0)->nullable();
            $table->json('project_distance')->nullable();
            $table->json('project_distance_update')->nullable();
            $table->string('contractor_credit')->nullable();
            $table->string('physical_progress')->nullable();
            $table->text('description')->nullable();
            $table->boolean('status')->default(0);
            $table->boolean('project_status')->default(0);
            $table->unsignedTinyInteger('rate')->nullable();
            $table->string('rate_desc')->nullable();
            $table->timestamps();
        });
    }

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