buckets/database/migrations/2025_12_30_234514_create_outflows_table.php

31 lines
964 B
PHP

<?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('outflows', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
$table->foreignId('stream_id')->nullable()->constrained()->onDelete('set null');
$table->foreignId('bucket_id')->nullable()->constrained()->onDelete('set null');
$table->unsignedBigInteger('amount');
$table->date('date');
$table->text('description')->nullable();
$table->boolean('is_projected')->default(true);
$table->timestamps();
$table->index(['bucket_id', 'date']);
$table->index('is_projected');
});
}
public function down(): void
{
Schema::dropIfExists('outflows');
}
};