<?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('equipment', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->string('serial_number')->unique();
    $table->date('purchase_date');
    $table->date('last_maintenance')->nullable();
    $table->enum('condition', ['excellent', 'good', 'needs_maintenance', 'out_of_service']);
    $table->text('notes')->nullable();
    $table->timestamps();
    
    // Add last_maintenance_date separately without AFTER
    $table->date('last_maintenance_date')->nullable();
});
    }

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