This commit is contained in:
Doar Mihai
2026-04-03 20:41:35 +03:00
parent 19d5e23dfd
commit a8a48f3f6f
13 changed files with 1185 additions and 0 deletions
@@ -0,0 +1,39 @@
<?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('api_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('job_source_id')->nullable()->constrained()->onDelete('cascade');
$table->string('endpoint');
$table->string('method', 10);
$table->integer('status_code')->nullable();
$table->integer('response_time_ms')->nullable();
$table->boolean('success')->default(false);
$table->text('error_message')->nullable();
$table->json('request_params')->nullable();
$table->json('response_data')->nullable();
$table->timestamps();
$table->index(['job_source_id', 'created_at']);
$table->index(['success', 'created_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('api_logs');
}
};
@@ -0,0 +1,39 @@
<?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('job_fetch_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('job_source_id')->constrained()->onDelete('cascade');
$table->boolean('success')->default(false);
$table->integer('jobs_fetched')->default(0);
$table->integer('jobs_created')->default(0);
$table->integer('jobs_updated')->default(0);
$table->integer('jobs_skipped')->default(0);
$table->integer('duration_seconds')->nullable();
$table->text('error_message')->nullable();
$table->json('metadata')->nullable();
$table->timestamps();
$table->index(['job_source_id', 'created_at']);
$table->index(['success', 'created_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('job_fetch_logs');
}
};
@@ -0,0 +1,38 @@
<?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('analytics_events', function (Blueprint $table) {
$table->id();
$table->string('event_type', 50); // job_view, job_apply_click, search, etc.
$table->foreignId('job_id')->nullable()->constrained()->onDelete('cascade');
$table->string('session_id', 100)->nullable();
$table->string('ip_address', 45)->nullable();
$table->string('user_agent')->nullable();
$table->string('referer')->nullable();
$table->json('event_data')->nullable(); // Additional event-specific data
$table->timestamp('created_at');
$table->index(['event_type', 'created_at']);
$table->index(['job_id', 'event_type', 'created_at']);
$table->index('session_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('analytics_events');
}
};