<?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('spending_logs', function (Blueprint $table) {
            $table->id();
            $table->string('client_id');
            $table->date('spend_date');
            $table->decimal('amount', 10, 2);
            $table->string('note')->nullable();
            $table->timestamps();
            
            $table->foreign('client_id')->references('client_id')->on('clients')->onDelete('cascade');
        });
    }

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