36 lines
1.2 KiB
PHP
36 lines
1.2 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('issues', function (Blueprint $table) {
|
|
$table->ulid('id')->primary();
|
|
$table->foreignUlid('project_id')->constrained()->cascadeOnDelete();
|
|
$table->string('fingerprint')->index();
|
|
$table->string('title');
|
|
$table->string('culprit')->nullable();
|
|
$table->string('level')->default('error');
|
|
$table->string('status')->default('unresolved');
|
|
$table->timestamp('first_seen_at');
|
|
$table->timestamp('last_seen_at');
|
|
$table->unsignedInteger('times_seen')->default(1);
|
|
$table->boolean('is_regression')->default(false);
|
|
$table->json('metadata')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['project_id', 'fingerprint']);
|
|
$table->index(['project_id', 'status', 'last_seen_at']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('issues');
|
|
}
|
|
};
|