<?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_expanses', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('id_user');
            $table->unsignedBigInteger('id_type_expanse');
            $table->double('amount')->default(0);
            $table->string('description', 200)->default('');
            $table->date('date');

            $table->foreign('id_user')
                ->references('id')->on('users');
            $table->foreign('id_type_expanse')
                ->references('id')->on('type_expanses');
            $table->timestamps();
        });
    }

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