Няма описание

2019_07_07_231850_create_professor_semester_table.php 1001B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateProfessorSemesterTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('professor_semester', function (Blueprint $table) {
  15. $table->unsignedBigInteger('professor_id');
  16. $table->char('semester_code', 3);
  17. $table->decimal('admin_load')->nullable();
  18. $table->decimal('investigative_load')->nullable();
  19. $table->foreign('professor_id')->references('id')->on('professors');
  20. $table->foreign('semester_code')->references('code')->on('semesters');
  21. $table->unique(['professor_id', 'semester_code']);
  22. });
  23. }
  24. /**
  25. * Reverse the migrations.
  26. *
  27. * @return void
  28. */
  29. public function down()
  30. {
  31. Schema::dropIfExists('professor_semester');
  32. }
  33. }