<?php

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

/**
 * Class CreateLocationsTable
 */
class CreateLocationsTable extends Migration
{
    protected $tableName = 'locations';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->tableName, function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('room')->nullable();
            //$table->unsignedInteger('state_id')->default(1);
            $table->timestamps();

            $table->unique('name');
            $table->unique('id');

            /*
            $table->foreign('state_id')
                ->references('id')->on('states')
                ->onUpdate('cascade')->onDelete('restrict');
            */
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->tableName);
    }
}
