<?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('ticket_escalation_rules', function (Blueprint $t) { $t->id(); $t->unsignedInteger('ticket_id'); $t->unsignedBigInteger('escalation_rule_id')->nullable(); $t->string('condition', 255); $t->string('action', 255); $t->json('changes')->nullable(); $t->enum('priority', ['low','medium','high'])->default('medium'); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->index('escalation_rule_id', 'ticket_escalation_rules_escalation_rule_id_foreign'); $t->index(['ticket_id', 'escalation_rule_id'], 'ticket_escalation_rules_ticket_id_escalation_rule_id_index'); $t->foreign('escalation_rule_id', 'ticket_escalation_rules_escalation_rule_id_foreign')->references('id')->on('escalation_rules')->onDelete('set null'); }); } public function down(): void { Schema::dropIfExists('ticket_escalation_rules'); } }; 