<?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_predefined_reply_departments', function (Blueprint $t) { $t->id(); $t->unsignedBigInteger('ticket_predefined_reply_id'); $t->unsignedBigInteger('ticket_department_id'); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->index('ticket_department_id', 'tpr_dept_dept_fk'); $t->unique(['ticket_predefined_reply_id', 'ticket_department_id'], 'tpr_dept_unique'); $t->foreign('ticket_department_id', 'tpr_dept_dept_fk')->references('id')->on('ticket_departments')->onDelete('cascade'); $t->foreign('ticket_predefined_reply_id', 'tpr_dept_reply_fk')->references('id')->on('ticket_predefined_replies')->onDelete('cascade'); }); } public function down(): void { Schema::dropIfExists('ticket_predefined_reply_departments'); } }; 