35 lines
1.0 KiB
PHP
35 lines
1.0 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->id();
|
|
$table->string('subject');
|
|
$table->string('status')->default('open');
|
|
$table->string('priority')->default('normal');
|
|
$table->string('department')->nullable();
|
|
$table->foreignIdFor(\App\Models\User::class)->constrained()->cascadeOnDelete();
|
|
$table->foreignIdFor(\App\Models\User::class, 'assigned_to')->nullable()->constrained('users')->nullOnDelete();
|
|
$table->foreignIdFor(\App\Models\Service::class)->nullable()->constrained()->nullOnDelete();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('tickets');
|
|
}
|
|
};
|