<?php

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

class CreateTournamentTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tournament', function (Blueprint $table) {
            $table->increments('id_tournament');
            $table->string('description')->nullable();
            $table->date('tournament_date');
            $table->integer('id_game')->unsigned();
            $table->foreign('id_game')->references('id_game')->on('game')->onDelete('restrict')->onUpdate('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
      // Schema::table('tournament', function(Blueprint $table) {
      //      $table->dropForeign('tournament_id_game_foreign');
      // });

      Schema::dropIfExists('tournament');
    }
}
