<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * Adds passport_path column to staff_histories table for storing
     * uploaded passport images/documents for staff records.
     *
     * @return void
     */
    public function up(): void
    {
        Schema::table('staff_histories', function (Blueprint $table) {
            $table->string('passport_path')->nullable()->after('termination_reason');
            $table->index('passport_path');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down(): void
    {
        Schema::table('staff_histories', function (Blueprint $table) {
            $table->dropIndex(['passport_path']);
            $table->dropColumn('passport_path');
        });
    }
};
