<?php

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

class CreateEintragungsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('eintragungen', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();

            $table->integer('user_id')->unsigned();
            $table->foreign('user_id')->references('id')->on('users');

            $table->integer('veranstaltung_id')->unsigned();
            $table->foreign('veranstaltung_id')->references('id')->on('veranstaltungen');

            $table->boolean('nicht_unbedingt')->default(false);
            $table->dateTime('kann_ab')->nullable();
            $table->dateTime('kann_bis')->nullable();
        });
    }

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