<?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('harim_histories', function (Blueprint $table) {
            $table->id();
            $table->foreignId('previous_state_id')->constrained('harim_states');
            $table->string('previous_state_name');
            $table->foreignId('harim_id')->constrained('harims')->cascadeOnDelete();
            $table->foreignId('action_id')->constrained('harim_actions');
            $table->string('action_name');
            $table->unsignedInteger('expert_id');
            $table->foreign('expert_id')->references('id')->on('users');
            $table->string('expert_description');
            $table->timestamps();
        });
    }

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