Files
KanbanGit/database/migrations/2026_03_25_004100_create_tickets_table.php
T
2026-04-13 01:04:06 +02:00

42 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->id();
$table->foreignId('project_id')->constrained()->cascadeOnDelete();
$table->foreignId('ticket_type_id')->constrained()->cascadeOnDelete();
$table->foreignId('ticket_priority_id')->constrained()->cascadeOnDelete();
$table->foreignId('assignee_user_id')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('author_user_id')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('board_column_id')->nullable()->constrained()->nullOnDelete();
$table->unsignedInteger('sequence_number');
$table->string('ticket_key')->unique();
$table->string('title');
$table->text('description')->nullable();
$table->text('acceptance_criteria')->nullable();
$table->unsignedInteger('story_points')->nullable()->default(null);
$table->timestamps();
$table->unique(['project_id', 'sequence_number']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tickets');
}
};