mirror of
https://github.com/dyzulk/trustlab-api.git
synced 2026-01-26 05:15:35 +07:00
44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('tickets', function (Blueprint $table) {
|
|
$table->uuid('id')->primary();
|
|
$table->foreignUuid('user_id')->constrained()->onDelete('cascade');
|
|
$table->string('ticket_number')->unique();
|
|
$table->string('subject');
|
|
$table->string('category'); // Technical, Billing, etc.
|
|
$table->enum('priority', ['low', 'medium', 'high'])->default('medium');
|
|
$table->enum('status', ['open', 'answered', 'closed'])->default('open');
|
|
$table->timestamps();
|
|
});
|
|
|
|
Schema::create('ticket_replies', function (Blueprint $table) {
|
|
$table->uuid('id')->primary();
|
|
$table->foreignUuid('ticket_id')->constrained()->onDelete('cascade');
|
|
$table->foreignUuid('user_id')->constrained()->onDelete('cascade');
|
|
$table->text('message');
|
|
$table->string('attachment_path')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('ticket_replies');
|
|
Schema::dropIfExists('tickets');
|
|
}
|
|
};
|