Ei kuvausta

2021_02_25_181655_typ_semester_courses.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. use Illuminate\Database\Schema\Blueprint;
  3. use Illuminate\Database\Migrations\Migration;
  4. class TypSemesterCourses extends Migration
  5. {
  6. /**
  7. * Run the migrations.
  8. *
  9. * @return void
  10. */
  11. public function up()
  12. {
  13. Schema::create('typ_semester_courses', function (Blueprint $table) {
  14. $table->increments('id');
  15. $table->timestamps();
  16. $table->integer('typ_semester_objective_id')->unsigned();
  17. $table->integer('course_id')->unsigned();
  18. $table->foreign('typ_semester_objective_id')
  19. ->references('id')
  20. ->on('typ_semester_objectives')
  21. ->onDelete('cascade')
  22. ->onUpdate('cascade');
  23. $table->foreign('course_id')
  24. ->references('id')
  25. ->on('courses')
  26. ->onDelete('cascade')
  27. ->onUpdate('cascade');
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. *
  33. * @return void
  34. */
  35. public function down()
  36. {
  37. Schema::table('typ_semester_courses', function (Blueprint $table) {
  38. $table->dropForeign("typ_semester_courses_course_id_foreign");
  39. $table->dropForeign("typ_semester_courses_typ_semester_outcome_id_foreign");
  40. });
  41. Schema::drop('typ_semester_courses');
  42. }
  43. }