<?php

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

class CreateTaCourseTable extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('ta_course', function (Blueprint $table) {
			$table->increments('id');

			$table->integer('ta_id')->unsigned();
			$table->foreign('ta_id')
				->references('id')
				->on('transformative_actions')
				->onDelete('cascade')
				->onUpdate('cascade');

			$table->integer('course_id')->unsigned();
			$table->foreign('course_id')
				->references('id')
				->on('courses')
				->onDelete('cascade')
				->onUpdate('cascade');
		});
	}

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