<?php

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

class CreateRoadPatrolSubProjectsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('road_patrol_sub_projects', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('road_patrol_project_id');
            $table->foreign('road_patrol_project_id')
                ->references('id')
                ->on('road_patrol_projects');
            $table->decimal('project_lat', 12, 10);
            $table->decimal('project_lng', 12, 10);
            $table->unsignedTinyInteger('item');
            $table->string('sub_items');
            $table->json('sub_items_data')->nullable();
            $table->timestamps();
        });
    }

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