<?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('provisioning_logs', function (Blueprint $t) { $t->id(); $t->string('provisioning_id', 50)->nullable(); $t->string('entity_type', 50); $t->unsignedBigInteger('entity_id'); $t->string('module_family', 30); $t->string('module_name', 50)->nullable(); $t->string('action', 50); $t->json('payload')->nullable(); $t->text('error_message')->nullable(); $t->json('error_details')->nullable(); $t->json('response_data')->nullable(); $t->string('status', 20)->default('pending'); $t->unsignedSmallInteger('attempts')->default(0); $t->timestamp('last_attempt_at')->nullable(); $t->timestamp('next_retry_at')->nullable(); $t->unsignedBigInteger('resolved_by_admin_id')->nullable(); $t->timestamp('resolved_at')->nullable(); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->index(['entity_type', 'entity_id', 'status'], 'provisioning_logs_entity_type_entity_id_status_index'); $t->index(['module_family', 'module_name', 'action'], 'provisioning_logs_module_family_module_name_action_index'); $t->index('next_retry_at', 'provisioning_logs_next_retry_at_index'); $t->index('provisioning_id', 'provisioning_logs_provisioning_id_index'); $t->index(['status', 'next_retry_at'], 'provisioning_logs_status_next_retry_at_index'); }); } public function down(): void { Schema::dropIfExists('provisioning_logs'); } }; 