mirror of
https://github.com/robonen/education-project.git
synced 2026-03-20 10:54:31 +00:00
Модуль журнала
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJournalsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('journals', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('teacher_id');
|
||||
$table->unsignedBigInteger('student_id');
|
||||
$table->unsignedBigInteger('subject_id');
|
||||
$table->unsignedBigInteger('score');
|
||||
$table->string('comment')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('subject_id')
|
||||
->references('id')->on('subjects');
|
||||
|
||||
$table->foreign('teacher_id')
|
||||
->references('id')->on('teachers')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('student_id')
|
||||
->references('id')->on('students')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('journals');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user