Files
Caramel-CRM/database/migrations/2025_11_28_000000_create_todo_table.php
T

35 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('todos', function (Blueprint $table) {
$table->string('id')->primary(); // ical UID
$table->string('etag')->nullable(); // ical etag
$table->string('title');
$table->text('description')->nullable();
$table->foreignId('type_id')->nullable()->constrained('todo_types')->nullOnDelete();
$table->string('url')->nullable();
$table->timestamp('due_date')->nullable();
$table->text('recurring')->nullable(); // RRULE
$table->tinyInteger('priority')->nullable();
$table->string('status')->nullable(); // e.g. IN-PROCESS, NEEDS-ACTION
$table->timestamp('created_at')->nullable(); // iCal CREATED
$table->timestamp('last_modified')->nullable(); // iCal LAST-MODIFIED
$table->string('parent')->nullable()->index(); // RELATED-TO (parent UID)
$table->string('object')->nullable(); // RELATED-TO (object reference)
$table->unsignedBigInteger('todoable_id');
$table->string('todoable_type');
$table->index(['id', 'todoable_id', 'todoable_type']);
});
}
public function down(): void
{
Schema::dropIfExists('todos');
}
};