<?php

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

/**
 * Class CreatePouzivateliaTable
 */
return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        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.
     */
    public function down(): void
    {
        Schema::dropIfExists('pouzivatelia');
    }
};
