41 lines
1.5 KiB
PHP
41 lines
1.5 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('tasks', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('project_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('parent_id')->nullable()->constrained('tasks')->nullOnDelete();
|
|
$table->string('title');
|
|
$table->text('description')->nullable();
|
|
$table->enum('status', ['todo', 'in_progress', 'review', 'done', 'cancelled'])->default('todo');
|
|
$table->enum('priority', ['low', 'medium', 'high', 'urgent'])->default('medium');
|
|
$table->foreignId('assignee_id')->nullable()->constrained('users')->nullOnDelete();
|
|
$table->date('due_date')->nullable();
|
|
$table->tinyInteger('progress')->default(0);
|
|
$table->decimal('estimated_hours', 5, 2)->nullable();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->index('tenant_id');
|
|
$table->index('project_id');
|
|
$table->index('parent_id');
|
|
$table->index('status');
|
|
$table->index('priority');
|
|
$table->index('assignee_id');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('tasks');
|
|
}
|
|
};
|