<?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('borrow_cancelled_histories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('borrower_company_id')->index();
            $table->date('date_requested');
            $table->bigInteger('requested_by')->index();
            $table->date('date_from');
            $table->date('date_to');
            $table->double('original_rate', 10, 2)->comment = 'Hard copy of worker rate without service charge';
            $table->double('rate', 10, 2)->comment = 'Hard copy of worker rate';
            $table->bigInteger('worker_id')->index();
            $table->bigInteger('cancelled_by')->index();
            $table->text('requester_note')->nullable()->comment = 'Borrower note';
            $table->timestamps();
        });
    }

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