<?php

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

class CreateFireStationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fire_stations', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->integer('number');
            $table->integer('province_id')->unsigned();
            $table->foreign('province_id')->references('id')->on('provinces');
            $table->integer('district_id')->unsigned();
            $table->foreign('district_id')->references('id')->on('districts');
            $table->integer('commune_id')->unsigned();
            $table->foreign('commune_id')->references('id')->on('communes');
            $table->string('post_office');
            $table->string('zip_code');
            $table->string('address');
            $table->float('latitude', 9,5);
            $table->float('longitude', 9,5);
            $table->string('KRS', 10);
            $table->string('NIP', 10);
            $table->string('phone_number', 20);
            $table->string('email');
            $table->integer('deleted')->default(0);
            $table->integer('creator_id')->nullable()->default(null);
            $table->integer('editor_id')->nullable()->default(null);
            $table->rememberToken();
            $table->timestamps();
        });
    }

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