<?php

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

class CreateTransformativeActions extends Migration
{

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('transformative_actions', function (Blueprint $table) {

			$table->increments('id');
			$table->timestamps();
			$table->boolean('is_custom');
			$table->integer('user_id')->unsigned()->nullable();
			$table->integer('program_id')->unsigned()->nullable();
			$table->text('at_text');
			$table->text('description');
			$table->boolean('by_professor');

			$table->foreign('user_id')
				->references('id')
				->on('users')
				->onDelete('cascade')
				->onUpdate('cascade');

			$table->foreign('program_id')
				->references('id')
				->on('programs')
				->onDelete('cascade')
				->onUpdate('cascade');
		});
	}

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