34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
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('streams', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('scenario_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('bucket_id')->nullable()->constrained()->nullOnDelete();
|
|
$table->string('name');
|
|
$table->boolean('is_active')->default(true);
|
|
$table->unsignedBigInteger('amount');
|
|
$table->enum('type', ['income', 'expense']);
|
|
$table->enum('frequency', ['once', 'weekly', 'biweekly', 'monthly', 'quarterly', 'yearly']);
|
|
$table->date('start_date');
|
|
$table->date('end_date')->nullable();
|
|
$table->text('description')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index(['scenario_id', 'is_active']);
|
|
$table->index('start_date');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('streams');
|
|
}
|
|
};
|