29 lines
1.1 KiB
PHP
29 lines
1.1 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 $t) {
|
|
$t->id();
|
|
$t->foreignId('user_id')->constrained()->cascadeOnDelete();
|
|
$t->foreignId('project_id')->nullable()->constrained()->nullOnDelete();
|
|
$t->string('title', 120);
|
|
$t->text('description')->nullable();
|
|
$t->enum('priority', ['low', 'med', 'high'])->default('med');
|
|
$t->unsignedSmallInteger('estimate_min')->nullable(); // estimación en min
|
|
$t->timestamp('deadline')->nullable();
|
|
$t->string('recurrence', 30)->nullable(); // 'daily', 'weekly', null
|
|
$t->boolean('done')->default(false);
|
|
$t->timestamp('done_at')->nullable();
|
|
$t->timestamp('snooze_until')->nullable();
|
|
$t->timestamps();
|
|
|
|
$t->index(['user_id', 'done', 'snooze_until']);
|
|
});
|
|
}
|
|
public function down(): void { Schema::dropIfExists('tasks'); }
|
|
};
|