<?php

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

class CreateTableNoteStation extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
       Schema::create('Note_Station', function(Blueprint $table) {
			$table->increments('id_Note_Station');
			$table->integer('note')->default(0);
            
            $table->integer('id_Station')->unsigned();
            $table->foreign('id_Station')->references('id_Station')->on('Station')
                        ->onDelete('cascade')
                        ->onUpdate('cascade');

            $table->integer('id_Note_Examen')->unsigned();
            $table->foreign('id_Note_Examen')->references('id_Note_Examen')->on('Note_Examen')
                        ->onDelete('cascade')
                        ->onUpdate('cascade');
		});
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {

        Schema::table('Note_Station', function(Blueprint $table) {
            $table->dropForeign('Note_Station_id_Station_foreign');
            $table->dropForeign('Note_Station_id_Note_Examen_foreign');
        });
        Schema::drop('Note_Station');
    }
}
