<?php

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

class CreateActivityStudent extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('activity_student', function (Blueprint $table) {
			$table->increments('id');
			$table->text('comments')->nullable();
			$table->integer('activity_id')->unsigned();
			$table->integer('student_id')->unsigned();
			$table->foreign('activity_id')
				->references('id')
				->on('activities')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->foreign('student_id')
				->references('id')
				->on('students')
				->onDelete('cascade')
				->onUpdate('cascade');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('activity_student');
	}
}
