Nav apraksta

2021_06_06_000025_create_criterion_objective_outcome_table.php 1.2KB

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