<?php

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

class CreateParticipatingProgramsView extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        DB::statement('
            CREATE VIEW VIEW_participating_programs
            AS
            SELECT 
                programs.id,
                programs.name,
                programs.is_graduate,
                programs.school_id,
                courses.semester_id
            FROM
                programs
                JOIN courses ON courses.program_id = programs.id;
        ');
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		DB::statement('DROP VIEW IF EXISTS VIEW_participating_programs');
	}

}
