Нема описа

2019_07_07_183013_create_departments_table.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateDepartmentsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('departments', function (Blueprint $table) {
  15. $table->bigIncrements('id');
  16. $table->string('code')->nullable();
  17. $table->string('name')->nullable();
  18. $table->unsignedBigInteger('faculty_id');
  19. $table->foreign('faculty_id')->references('id')->on('faculties');
  20. });
  21. // DB::table('departments')->insert(
  22. // array(
  23. // array('id' => '1','name' => 'BIOL', 'title' => 'Biolo'),
  24. // array('id' => '4','name' => 'CIAM', 'title' => ),
  25. // array('id' => '2','name' => 'FISI', 'title' => ),
  26. // array('id' => '3','name' => 'MATE', 'title' => ),
  27. // array('id' => '5','name' => 'PGCN', 'title' => ),
  28. // array('id' => '6','name' => 'QUIM', 'title' => ),
  29. // array('id' => '7','name' => 'default'),
  30. // ));
  31. }
  32. /**
  33. * Reverse the migrations.
  34. *
  35. * @return void
  36. */
  37. public function down()
  38. {
  39. Schema::dropIfExists('departments');
  40. }
  41. }