<?php

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

class CreateCoridorsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coridors', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedTinyInteger('province_id')->nullable();
            $table->foreign('province_id')
                  ->references('id')
                  ->on('provinces');
            $table->unsignedSmallInteger('city_id')->nullable();
            $table->foreign('city_id')
                  ->references('id')
                  ->on('cities');
            $table->string('province_name')->nullable();
            $table->string('city_name')->nullable();
            $table->string('name')->nullable();
            $table->string('status')->nullable();
            $table->string('type')->nullable();
            $table->string('team_num')->nullable();
            $table->string('staff_num')->nullable();
            $table->string('phone')->nullable();
            $table->string('responsible_name')->nullable();
            $table->string('responsible_mobile')->nullable();
            $table->string('successor_name')->nullable();
            $table->string('successor_mobile')->nullable();
            $table->string('machines_light')->nullable();
            $table->string('machines_sheavy')->nullable();
            $table->string('machines_heavy')->nullable();
            $table->string('code')->nullable();
            $table->string('lat')->nullable();
            $table->string('lng')->nullable();
            $table->string('machine_data',500)->nullable();
            $table->string('team_data',500)->nullable();
            $table->string('start_lat')->nullable();
            $table->string('start_lng')->nullable();
            $table->string('end_lat')->nullable();
            $table->string('end_lng')->nullable();
            $table->string('color')->nullable();
            $table->mediumText('geometry')->nullable();
            $table->timestamps();
        });
    }

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