<?php

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

class CreateAnnualPlansTable extends Migration
{

	public function up()
	{
		Schema::create('annual_plans', function (Blueprint $table) {

			$table->increments('id');
			$table->integer('annual_cycle_id')->unsigned();
			$table->integer('program_id')->unsigned();
			$table
				->foreign('program_id')
				->references('id')
				->on('programs')
				->onDelete('cascade')
				->onUpdate('cascade');
			$table->boolean('is_submitted')->default(0);
			$table->dateTime('submitted_on')->nullable();
			$table->timestamps();
		});
	}


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