Files
dashboard-ticketing/database/migrations/2026_04_08_000001_create_tickets_table.php
2026-04-08 14:17:26 -07:00

29 lines
978 B
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->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('assigned_to')->nullable()->constrained('users')->nullOnDelete();
$table->string('title');
$table->text('description');
$table->enum('category', ['IT', 'Facilities', 'HR', 'Other'])->default('Other');
$table->enum('priority', ['low', 'medium', 'high', 'urgent'])->default('medium');
$table->enum('status', ['open', 'in_progress', 'resolved', 'closed'])->default('open');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('tickets');
}
};