<?php

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

class CreateNoHomesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('no_homes', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('contract_id');
            $table->string('house_photo')->nullable();
            $table->string('house_description')->nullable();
            $table->geography('location', subtype: 'point')->nullable();
            $table->timestamp('confirmed_at')->nullable();
            $table->timestamps();
            $table->foreign('contract_id')->references('id')->on('finished_contracts')->onDelete('cascade');
        });
    }

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