Files
trackbugs/database/migrations/2026_03_19_000004_create_events_table.php
2026-03-19 19:25:51 +02:00

44 lines
1.6 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('events', function (Blueprint $table) {
$table->ulid('id')->primary();
$table->foreignUlid('issue_id')->constrained()->cascadeOnDelete();
$table->foreignUlid('project_id')->constrained()->cascadeOnDelete();
$table->string('event_id')->unique();
$table->string('level')->default('error');
$table->text('message')->nullable();
$table->string('platform')->nullable();
$table->timestamp('timestamp');
$table->string('server_name')->nullable();
$table->string('release')->nullable();
$table->string('environment')->nullable();
$table->json('exception');
$table->json('breadcrumbs')->nullable();
$table->json('contexts')->nullable();
$table->json('tags')->nullable();
$table->json('extra')->nullable();
$table->json('user_context')->nullable();
$table->json('request_context')->nullable();
$table->json('sdk')->nullable();
$table->json('raw_payload');
$table->timestamp('created_at')->nullable();
$table->index(['project_id', 'timestamp']);
$table->index(['issue_id', 'timestamp']);
});
}
public function down(): void
{
Schema::dropIfExists('events');
}
};