<?php

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

class CreateBlocksTable extends Migration
{
    public function up()
    {
        Schema::create('blocks', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('country_id')->nullable();
            $table->foreign('country_id')->nullable()->on('countries')->references('id')->onDelete('cascade')->onUpdate('cascade');
            $table->string('address')->nullable();
            $table->string('title')->nullable();
            $table->string('latitude')->nullable();
            $table->string('longitude')->nullable();
            $table->timestamps();
        });
        Schema::create('blocks_real', function (Blueprint $table) {
            $table->id();
            $table->string('gov')->nullable();
            $table->string('address')->nullable();
            $table->string('title')->nullable();
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists('blocks_real');
        Schema::dropIfExists('blocks');
    }
}
