apilogs
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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('api_logs', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('service', 32)->comment('e.g. fuel_finder, fred, postcodes_io');
|
||||
$table->string('method', 8)->comment('HTTP method: GET, POST');
|
||||
$table->string('url', 512)->comment('Full URL including query string');
|
||||
$table->unsignedSmallInteger('status_code')->nullable()->comment('HTTP status code; null if request threw an exception');
|
||||
$table->unsignedInteger('duration_ms')->comment('Round-trip response time in milliseconds');
|
||||
$table->text('error')->nullable()->comment('Exception message if request failed');
|
||||
$table->dateTime('created_at');
|
||||
|
||||
$table->index('service');
|
||||
$table->index('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('api_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user