暫無描述

2020_10_18_145108_create_outcome_performance_table.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. use Illuminate\Database\Schema\Blueprint;
  3. use Illuminate\Database\Migrations\Migration;
  4. class CreateOutcomePerformanceTable extends Migration {
  5. /**
  6. * Run the migrations.
  7. *
  8. * @return void
  9. */
  10. public function up()
  11. {
  12. Schema::create('outcome_performance', function(Blueprint $table)
  13. {
  14. $table->increments('id');
  15. $table->integer('criterion_id')->unsigned();
  16. $table->integer('outcome_id')->unsigned();
  17. $table->integer('semester_id')->unsigned();
  18. $table->integer('students_attempted');
  19. $table->integer('students_achieved');
  20. $table->smallInteger('level');
  21. $table
  22. ->foreign('criterion_id')
  23. ->references('id')
  24. ->on('criteria')
  25. ->onDelete('cascade')
  26. ->onUpdate('cascade');
  27. $table
  28. ->foreign('outcome_id')
  29. ->references('id')
  30. ->on('outcomes')
  31. ->onDelete('cascade')
  32. ->onUpdate('cascade');
  33. $table
  34. ->foreign('semester_id')
  35. ->references('id')
  36. ->on('semesters')
  37. ->onDelete('cascade')
  38. ->onUpdate('cascade');
  39. $table->timestamps();
  40. });
  41. }
  42. /**
  43. * Reverse the migrations.
  44. *
  45. * @return void
  46. */
  47. public function down()
  48. {
  49. Schema::drop('outcome_performance');
  50. }
  51. }