32 lines
1.1 KiB
PHP
32 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('installments', function (Blueprint $table): void {
|
|
$table->id();
|
|
$table->foreignId('account_id')->constrained('accounts')->cascadeOnDelete();
|
|
$table->decimal('amount', 20, 4);
|
|
$table->decimal('balance_before', 20, 4)->nullable();
|
|
$table->string('currency', 3)->default('EUR');
|
|
$table->string('reference', 100)->nullable();
|
|
$table->timestamp('installment_at')->nullable();
|
|
$table->json('meta')->nullable();
|
|
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
|
$table->foreignId('activity_id')->nullable()->constrained('activities')->nullOnDelete();
|
|
$table->softDeletes();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('installments');
|
|
}
|
|
};
|