38 lines
1.4 KiB
PHP
38 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 {
|
|
public function up(): void
|
|
{
|
|
Schema::create('tasks', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('tenant_id')->constrained()->onDelete('cascade');
|
|
$table->unsignedBigInteger('emotion_id')->nullable();
|
|
$table->unsignedBigInteger('event_type_id')->nullable();
|
|
$table->string('title');
|
|
$table->text('description')->nullable();
|
|
$table->text('example_text')->nullable();
|
|
$table->dateTime('due_date')->nullable();
|
|
$table->boolean('is_completed')->default(false);
|
|
$table->enum('priority', ['low', 'medium', 'high', 'urgent'])->default('medium');
|
|
$table->unsignedBigInteger('collection_id')->nullable();
|
|
$table->enum('difficulty', ['easy','medium','hard'])->default('easy');
|
|
$table->integer('sort_order')->default(0);
|
|
$table->boolean('is_active')->default(true);
|
|
$table->timestamps();
|
|
|
|
$table->foreign('collection_id')->references('id')->on('task_collections')->onDelete('set null');
|
|
$table->index(['tenant_id', 'is_completed', 'priority']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('tasks');
|
|
}
|
|
};
|
|
|