<?php

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

class CreateTableSession extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('Session', function(Blueprint $table) {
			$table->increments('id_Session');
			$table->string('nom',20);
            $table->integer('id_Niveau')->unsigned();
            $table->foreign('id_Niveau')->references('id_Niveau')->on('Niveau')
                        ->onDelete('cascade')
                        ->onUpdate('cascade');
		});   
    }

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