<?php

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

class CreateStageTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
  public function up()
    {
         Schema::create('Stage', function(Blueprint $table) {
            $table->increments('id_Stage');
            $table->string('nom',100);

            $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('Stage', function(Blueprint $table) {
            $table->dropForeign('Stage_id_Niveau_foreign');
        });

        Schema::drop('Stage');

    }
}
