<?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('payrolls', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('reference_no',50)->index();
            $table->date('payroll_date')->index();
            $table->string('cut_off', 5)->index();
            $table->unsignedMediumInteger('company_id')->index();
            $table->unsignedMediumInteger('dealership_id')->index();
            $table->string('posted_by',20)->nullable();
            $table->datetime('posted_at')->nullable();
            $table->string('released_by',20)->nullable();
            $table->datetime('released_at')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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