<?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('workflow_logs', function (Blueprint $t) { $t->id(); $t->unsignedBigInteger('workflow_id'); $t->string('entity_type', 255)->nullable(); $t->unsignedBigInteger('entity_id')->nullable(); $t->string('status', 255)->default('success'); $t->json('nodes_executed')->nullable(); $t->text('error_message')->nullable(); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->index(['workflow_id', 'created_at'], 'workflow_logs_workflow_id_created_at_index'); $t->foreign('workflow_id', 'workflow_logs_workflow_id_foreign')->references('id')->on('workflows')->onDelete('cascade'); }); } public function down(): void { Schema::dropIfExists('workflow_logs'); } }; 