<?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_edges', function (Blueprint $t) { $t->id(); $t->unsignedBigInteger('workflow_id'); $t->unsignedBigInteger('from_node_id'); $t->unsignedBigInteger('to_node_id'); $t->enum('source_port', ['default','true','false'])->default('default'); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->unique(['from_node_id', 'source_port'], 'workflow_edges_from_node_id_source_port_unique'); $t->index('to_node_id', 'workflow_edges_to_node_id_foreign'); $t->index('workflow_id', 'workflow_edges_workflow_id_index'); $t->foreign('from_node_id', 'workflow_edges_from_node_id_foreign')->references('id')->on('workflow_nodes')->onDelete('cascade'); $t->foreign('to_node_id', 'workflow_edges_to_node_id_foreign')->references('id')->on('workflow_nodes')->onDelete('cascade'); $t->foreign('workflow_id', 'workflow_edges_workflow_id_foreign')->references('id')->on('workflows')->onDelete('cascade'); }); } public function down(): void { Schema::dropIfExists('workflow_edges'); } }; 