<?php
// database/migrations/2026_05_28_000001_create_expense_categories_table.php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('expense_categories', function (Blueprint $table) {
            $table->id();
            $table->string('name', 100);
            $table->string('description', 255)->nullable();
            $table->string('color', 20)->nullable()->default('#6c757d');
            $table->boolean('is_active')->default(true);
            $table->unsignedBigInteger('company_id');
            $table->timestamps();
            
            $table->foreign('company_id')->references('id')->on('company')->onDelete('cascade');
            $table->index('company_id');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('expense_categories');
    }
};