<?php

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

/**
 * Class CreatePouzivateliaTable
 */
class CreatePouzivateliaTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pouzivatelia', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('pracovisko_id');

            $table->string('login')->unique();
            $table->string('meno');
            $table->boolean('blokovany')->default(false);
            $table->dateTime('datum_posledneho_prihlasenia')->nullable();

            $table->foreign('pracovisko_id')->references('id')->on('pracoviska')->onDelete('cascade');

            $table->timestamps();
        });
    }

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