Files
Aigo/database/migrations/2024_06_01_051819_create_result_table.php
2026-06-04 20:58:26 +07:00

37 lines
1.1 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('result', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('patient_id');
$table->unsignedBigInteger('doctor_id');
$table->unsignedBigInteger('consultation_id')->nullable();
$table->integer('jarak_lari');
$table->float('sleeptime');
$table->string('food');
$table->string('unrecommended_food');
$table->text('notes');
$table->timestamps();
$table->foreign('patient_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('doctor_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('consultation_id')->references('id')->on('consultations')->onDelete('set null');
});
}
public function down(): void
{
Schema::dropIfExists('result');
}
};