42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?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('transactions', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('company_id')->constrained()->cascadeOnDelete();
|
|
$table->string('reference')->unique();
|
|
$table->decimal('amount', 16, 2);
|
|
$table->string('currency', 3)->default('EUR');
|
|
$table->string('counterparty');
|
|
$table->string('counterparty_country', 2)->nullable();
|
|
$table->string('channel')->nullable();
|
|
$table->dateTime('executed_at');
|
|
$table->unsignedTinyInteger('risk_score')->default(0);
|
|
$table->string('status', 32)->index();
|
|
$table->boolean('requires_review')->default(true);
|
|
$table->string('flagged_by')->nullable();
|
|
$table->text('flagged_reason')->nullable();
|
|
$table->json('signals')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('transactions');
|
|
}
|
|
};
|