Files
construprogress/database/migrations/2026_05_06_122423_create_features_table.php
T

40 lines
1.4 KiB
PHP
Raw Normal View History

2026-05-07 23:31:33 +02:00
<?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('features', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->nullable()->unique();
2026-05-07 23:31:33 +02:00
$table->foreignId('layer_id')->constrained()->onDelete('cascade');
$table->string('name')->nullable();
$table->json('geometry'); // GeoJSON geometry object (Point, LineString, Polygon)
$table->json('properties')->nullable(); // propiedades extra (progreso, responsable, etc.)
$table->foreignId('template_id')->nullable()->constrained('inspection_templates');
$table->integer('progress')->default(0);
$table->enum('status', ['planned', 'started', 'in_progress', 'completed', 'verified'])->default('planned');
2026-05-07 23:31:33 +02:00
$table->string('responsible')->nullable();
$table->foreignId('responsible_user_id')->nullable()->constrained('users')->nullOnDelete();
$table->timestamp('client_updated_at')->nullable();
2026-05-07 23:31:33 +02:00
$table->timestamps();
$table->softDeletes();
2026-05-07 23:31:33 +02:00
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('features');
}
};