1
0
mirror of https://github.com/robonen/education-project.git synced 2026-03-20 10:54:31 +00:00
Files
education-project/database/migrations/2020_11_17_164043_create_students_table.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');
}
}