Ei kuvausta

2019_07_07_152338_create_semesters_table.php 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. use App\Semester;
  6. class CreateSemestersTable extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. Schema::create('semesters', function (Blueprint $table) {
  16. $table->char('code', 3)->primary();
  17. $table->string('alpha');
  18. });
  19. DB::table('semesters')->insert(
  20. array(
  21. array('code' => 'B31','alpha' => '2013-2014 SEM 1'),
  22. array('code' => 'B32','alpha' => '2013-2014 SEM 2'),
  23. array('code' => 'B33','alpha' => '2013-2014 VERANO'),
  24. array('code' => 'B41','alpha' => '2014-2015 SEM 1'),
  25. array('code' => 'B42','alpha' => '2014-2015 SEM 2'),
  26. array('code' => 'B43','alpha' => '2014-2015 VERANO'),
  27. array('code' => 'B51','alpha' => '2015-2016 SEM 1'),
  28. array('code' => 'B52','alpha' => '2015-2016 SEM 2'),
  29. array('code' => 'B53','alpha' => '2015-2016 VERANO'),
  30. array('code' => 'B61','alpha' => '2016-2017 SEM 1'),
  31. array('code' => 'B62','alpha' => '2016-2017 SEM 2'),
  32. array('code' => 'B63','alpha' => '2016-2017 VERANO'),
  33. array('code' => 'B71','alpha' => '2017-2018 SEM 1'),
  34. array('code' => 'B72','alpha' => '2017-2018 SEM 2'),
  35. array('code' => 'B73','alpha' => '2017-2018 VERANO'),
  36. array('code' => 'B81','alpha' => '2018-2019 SEM 1'),
  37. array('code' => 'B82','alpha' => '2018-2019 SEM 2'),
  38. array('code' => 'B83','alpha' => '2018-2019 VERANO'),
  39. array('code' => 'B91','alpha' => '2019-2020 SEM 1'),
  40. array('code' => 'B92','alpha' => '2019-2020 SEM 2'),
  41. array('code' => 'B93','alpha' => '2019-2020 VERANO'),
  42. array('code' => 'C01','alpha' => '2020-2021 SEM 1'),
  43. array('code' => 'C02','alpha' => '2020-2021 SEM 2'),
  44. array('code' => 'C03','alpha' => '2020-2021 VERANO')
  45. )
  46. );
  47. }
  48. /**
  49. * Reverse the migrations.
  50. *
  51. * @return void
  52. */
  53. public function down()
  54. {
  55. Schema::dropIfExists('semesters');
  56. }
  57. }