Files
dashboard-ticketing/database/migrations/2026_04_08_000004_create_tickets_table.php

32 lines
1.1 KiB
PHP

<?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('tickets', function (Blueprint $table) {
$table->id();
$table->string('number')->unique(); // e.g. "IT-0042"
$table->foreignId('group_id')->constrained('ticketing_groups');
$table->unsignedBigInteger('submitter_id');
$table->unsignedBigInteger('assigned_to')->nullable();
$table->foreignId('project_id')->nullable()->constrained('ticketing_projects')->nullOnDelete();
$table->string('title');
$table->text('description');
$table->enum('status', ['open', 'in_progress', 'pending', 'resolved', 'closed'])->default('open');
$table->foreignId('priority_id')->nullable()->constrained('ticketing_priority_levels')->nullOnDelete();
$table->date('due_date')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('tickets');
}
};