32 lines
1006 B
PHP
32 lines
1006 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('findings', function (Blueprint $table) {
|
||
|
|
$table->id();
|
||
|
|
$table->foreignId('target_id')->constrained()->cascadeOnDelete();
|
||
|
|
$table->foreignId('source_id')->constrained()->cascadeOnDelete();
|
||
|
|
$table->foreignId('run_by')->nullable()->constrained('users')->nullOnDelete();
|
||
|
|
$table->string('status')->default('pending');
|
||
|
|
$table->json('raw_payload')->nullable();
|
||
|
|
$table->text('summary')->nullable();
|
||
|
|
$table->text('error')->nullable();
|
||
|
|
$table->timestamp('ran_at')->nullable();
|
||
|
|
$table->timestamps();
|
||
|
|
|
||
|
|
$table->index(['target_id', 'source_id']);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down(): void
|
||
|
|
{
|
||
|
|
Schema::dropIfExists('findings');
|
||
|
|
}
|
||
|
|
};
|