<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pasien', function (Blueprint $table) {
            $table->id();
            $table->string('nama');
            $table->unsignedBigInteger('jenis_kelamin_id');
            $table->integer('umur');
            $table->double('berat');
            $table->double('tinggi');
            $table->unsignedBigInteger('aktivitas_id');
            $table->unsignedBigInteger('kadar_gula_id');
            $table->unsignedBigInteger('kebutuhan_kalori_id');
            $table->enum('status', ['Underweight', ' Normal', 'Overweight', 'Obesitas']);
            $table->foreign('jenis_kelamin_id')->references('id')->on('jenis_kelamin');
            $table->foreign('aktivitas_id')->references('id')->on('aktivitas');
            $table->foreign('kadar_gula_id')->references('id')->on('kadar_gula');
            $table->foreign('kebutuhan_kalori_id')->references('id')->on('kebutuhan_kalori');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('pasien');
    }
};
