<?php

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

class CreateTrainingRoomsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up() {

        Schema::create('training_rooms', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger("box_id");
            $table->string("name", 100);
            $table->string("description", 300);
            $table->integer("capacity");
            $table->timestamps();

            $table->foreign("box_id")->references("id")->on("boxes")->onDelete("cascade"); //si borren un box, que borri les seves training rooms
        });

    }

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