id(); $table->uuid()->unique(); $table->foreignId('device_id')->constrained()->cascadeOnDelete(); $table->string('type'); // switch | light | power | contact | temperature | humidity | motion | battery $table->string('key'); // e.g. switch:0, cover:0 $table->string('name')->nullable(); $table->json('capabilities')->nullable(); $table->timestamps(); $table->unique(['device_id', 'key']); }); } public function down(): void { Schema::dropIfExists('entities'); } };