char('id', 36)->primary(); $table->char('map_id', 36); // Foreign key to associate with a map $table->boolean('isFreehand'); $table->float('totalArea'); $table->string('units'); $table->string('color'); $table->bigInteger('layerId'); $table->float('radius')->nullable(); $table->timestamps(); $table->foreign('map_id')->references('id')->on('maps')->onDelete('cascade'); }); } if (!Schema::hasTable('triangles')) { Schema::create('triangles', function (Blueprint $table) { $table->char('id', 36)->primary(); $table->float('area'); $table->string('color'); $table->bigInteger('layerId'); $table->char('parentId', 36)->nullable(); $table->char('polygon_id', 36); // UUID to match the type in polygons table $table->foreign('polygon_id')->references('id')->on('polygons')->onDelete('cascade'); $table->timestamps(); }); } } public function down(): void { Schema::dropIfExists('polygons'); Schema::dropIfExists('triangles'); } };