<?php

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

class CreateTableEncadrantServiceEtudiant extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('Encadrant_Service_Etudiant', function(Blueprint $table) {
			$table->increments('id_Encadrant_Service_Etudiant');
			$table->boolean('isValid')->default(false);

                        
            $table->integer('id_Service')->unsigned();
            $table->foreign('id_Service')->references('id_Service')->on('Service')
                        ->onDelete('cascade')
                        ->onUpdate('cascade');

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

    }

    /**
     * Reverse the migrations.
     *
     * @return voids
     */
    public function down()
    {
        Schema::table('Encadrant_Stage_Etudiant', function(Blueprint $table) {
            $table->dropForeign('Encadrant_Service_Etudiant_id_Service_foreign');
            $table->dropForeign('Encadrant_Service_Etudiant_id_Etudiant_foreign');
        });
        Schema::drop('Encadrant_Service_Etudiant');
    }
}
