<?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_department_custom_fields', function (Blueprint $t) { $t->id(); $t->unsignedBigInteger('ticket_department_id'); $t->string('name', 255); $t->enum('type', ['text','textarea','select','checkbox','radio','email','number','date']); $t->boolean('required')->default(0); $t->text('options')->nullable(); $t->integer('sort_order')->default(0); $t->timestamp('created_at')->nullable(); $t->timestamp('updated_at')->nullable(); $t->index(['ticket_department_id', 'sort_order'], 'td_custom_fields_dept_sort_index'); $t->foreign('ticket_department_id', 'ticket_department_custom_fields_ticket_department_id_foreign')->references('id')->on('ticket_departments')->onDelete('cascade'); }); } public function down(): void { Schema::dropIfExists('ticket_department_custom_fields'); } }; 