Implement webhook inspector
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?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('webhook_endpoints', function (Blueprint $table) {
|
||||
$table->ulid('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('name')->nullable();
|
||||
$table->text('token');
|
||||
$table->char('token_hash', 64)->unique();
|
||||
$table->boolean('is_public')->default(true);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamp('expires_at')->nullable()->index();
|
||||
$table->unsignedSmallInteger('response_status')->default(200);
|
||||
$table->longText('response_headers')->nullable();
|
||||
$table->longText('response_body')->nullable();
|
||||
$table->timestamp('last_request_at')->nullable()->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'created_at']);
|
||||
$table->index(['is_public', 'expires_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('webhook_endpoints');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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('webhook_requests', function (Blueprint $table) {
|
||||
$table->ulid('id')->primary();
|
||||
$table->foreignUlid('webhook_endpoint_id')
|
||||
->constrained('webhook_endpoints')
|
||||
->cascadeOnDelete();
|
||||
$table->string('method', 10);
|
||||
$table->text('request_uri');
|
||||
$table->longText('headers')->nullable();
|
||||
$table->longText('query_parameters')->nullable();
|
||||
$table->longText('body')->nullable();
|
||||
$table->longText('json_payload')->nullable();
|
||||
$table->string('content_type')->nullable();
|
||||
$table->unsignedInteger('body_size')->default(0);
|
||||
$table->ipAddress('ip_address')->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->timestamp('received_at')->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['webhook_endpoint_id', 'received_at']);
|
||||
$table->index(['webhook_endpoint_id', 'method', 'received_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('webhook_requests');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user