mirror of
https://github.com/robonen/education-project.git
synced 2026-03-20 02:44:31 +00:00
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateStudentsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('students', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('user_id')->unique();
|
|
$table->string('photo')->nullable();
|
|
$table->string('name')->nullable();
|
|
$table->string('surname')->nullable();
|
|
$table->string('patronymic')->nullable();
|
|
$table->unsignedInteger('class_id')->nullable();
|
|
$table->string('information_about_me')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->foreign('user_id')
|
|
->references('id')->on('users')
|
|
->onDelete('cascade');
|
|
$table->foreign('class_id')
|
|
->references('id')->on('school_classes')
|
|
->onDelete('set null');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('students');
|
|
}
|
|
}
|