No Description

2019_07_07_231913_create_professor_section_table.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateProfessorSectionTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('professor_section', function (Blueprint $table) {
  15. $table->unsignedBigInteger('professor_id');
  16. $table->unsignedBigInteger('section_id');
  17. $table->unsignedInteger('percent')->nullable();
  18. $table->string('schedule')->nullable();
  19. $table->float('eval')->nullable();
  20. $table->foreign('professor_id')->references('id')->on('professors')->onUpdate('cascade');
  21. $table->foreign('section_id')->references('id')->on('sections')->onUpdate('cascade');
  22. $table->unique(['professor_id', 'section_id']);
  23. });
  24. }
  25. /**
  26. * Reverse the migrations.
  27. *
  28. * @return void
  29. */
  30. public function down()
  31. {
  32. Schema::dropIfExists('professor_section');
  33. }
  34. }