<?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('previsional_incomes', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('id_user');
            $table->unsignedBigInteger('id_type_income');
            $table->double('amount');
            $table->string('description', 200)->default('');
            $table->date('date');
            
            $table->foreign('id_user')
                ->references('id')->on('users');
            $table->foreign('id_type_income')
                ->references('id')->on('type_incomes');
            $table->timestamps();
        });
    }

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