Нет описания

2021_06_02_000647_create_students_table.php 921B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. use Illuminate\Database\Schema\Blueprint;
  3. use Illuminate\Database\Migrations\Migration;
  4. class CreateStudentsTable extends Migration
  5. {
  6. /**
  7. * Run the migrations.
  8. *
  9. * @return void
  10. */
  11. public function up()
  12. {
  13. Schema::create('students', function (Blueprint $table) {
  14. $table->increments('id');
  15. $table->char('number', 9);
  16. $table->string('name', 100);
  17. $table->char('school_code', 2)->nullable();
  18. $table->char('conc_code', 4)->nullable();
  19. $table->string('email', 40)->default('no.email.olas@upr.edu');
  20. $table->integer('program_id')->unsigned()->nullable();
  21. $table->timestamps();
  22. });
  23. Schema::table('students', function (Blueprint $table) {
  24. $table->foreign('program_id')->references('id')->on('programs')->onDelete('cascade')->onUpdate('cascade');
  25. });
  26. }
  27. /**
  28. * Reverse the migrations.
  29. *
  30. * @return void
  31. */
  32. public function down()
  33. {
  34. Schema::drop('students');
  35. }
  36. }