<?php

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

class UpdateRiwayatPenyakitTable extends Migration
{
    public function up()
    {
        Schema::table('riwayat_penyakit', function (Blueprint $table) {
            $table->dropColumn('tanggal'); // hapus kolom lama
            $table->dateTime('tanggal_sakit')->nullable(); // tambahkan kolom baru
        });
    }

    public function down()
    {
        Schema::table('riwayat_penyakit', function (Blueprint $table) {
            $table->dropColumn('tanggal_sakit'); // rollback: hapus kolom baru
            $table->dateTime('tanggal')->nullable(); // rollback: tambah lagi kolom lama
        });
    }
}
