id(); $table->foreignId('tenant_id')->constrained()->onDelete('cascade'); $table->unsignedBigInteger('emotion_id')->nullable(); $table->unsignedBigInteger('event_type_id')->nullable(); $table->json('title'); $table->json('description')->nullable(); $table->json('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'); } };