mirror of
https://github.com/robonen/education-project.git
synced 2026-03-20 02:44:31 +00:00
49 lines
1.4 KiB
PHP
49 lines
1.4 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');
|
|
$table->string('photo')->nullable();
|
|
$table->string('first_name')->nullable();
|
|
$table->string('second_name')->nullable();
|
|
$table->string('middle_name')->nullable();
|
|
$table->date('date_of_birth')->nullable();
|
|
$table->string('phone_number')->nullable();
|
|
$table->string('address')->nullable();
|
|
$table->string('passport_or_certificate')->nullable();
|
|
$table->unsignedBigInteger('class_id')->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');
|
|
}
|
|
}
|