12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
-
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Database\Migrations\Migration;
-
- class StudentOutcomeAssessView extends Migration {
-
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- //
- DB::statement("
- CREATE VIEW `student_outcome_assess`
- AS SELECT
- `eval`.`student_id` AS `student_id`,
- `eval`.`semester_id` AS `semester_id`,
- `eval`.`outcome_id` AS `outcome_id`,sum(`eval`.`total_evaluated`) AS `total_evaluated`,sum(coalesce(`ach`.`total_achieved`,0)) AS `total_achieved`
- FROM (`student_criteria_evaluated` `eval` left join `student_criteria_achieved` `ach` on(((`eval`.`student_id` = `ach`.`student_id`) and (`eval`.`semester_id` = `ach`.`semester_id`) and (`eval`.`criterion_id` = `ach`.`criterion_id`) and (`eval`.`outcome_id` = `ach`.`outcome_id`)))) group by `eval`.`student_id`,`eval`.`semester_id`,`eval`.`outcome_id`;
- ");
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- //
- DB::statement('DROP VIEW IF EXISTS student_outcome_assess');
- }
-
- }
|