<?php

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

class CreatePengajuanHistoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
{
    Schema::create('history_pengajuans', function (Blueprint $table) {
        $table->id();
        $table->unsignedBigInteger('pengajuan_id');
        $table->unsignedBigInteger('user_id'); // Siapa yang proses (Manajer/Direktur)
        $table->string('status_saat_itu');
        $table->text('catatan')->nullable();
        $table->timestamps();

        $table->foreign('pengajuan_id')->references('id')->on('pengajuan_keuangans')->onDelete('cascade');
        $table->foreign('user_id')->references('id')->on('users');
    });
}
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
{
    Schema::dropIfExists('history_pengajuans');
}

}
