Files
mytodos/database/migrations/2026_09_18_045606_create_todos_table.php
T
ecdown 1e8ae3d1e5
tests / ci (push) Canceled after 0s
first commit;
2026-09-17 23:01:26 -07:00

36 lines
930 B
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('todos', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('folder_id')->constrained()->cascadeOnDelete();
$table->string('description');
$table->date('due_date');
$table->timestamp('completed_at')->nullable();
$table->timestamps();
$table->index(['user_id', 'completed_at']);
$table->index(['user_id', 'due_date']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('todos');
}
};