id(); $table->string('name',50); $table->string('description',125)->nullable(); $table->softDeletes(); $table->timestamps(); }); Schema::create('objects', function (Blueprint $table) { $table->id(); $table->string('reference', 125)->nullable(); $table->string('name', 255); $table->string('description', 255)->nullable(); // If you keep the column name as 'type_id', specify the table explicitly $table->foreignId('type_id')->constrained('object_types')->nullOnDelete(); // Indexes for faster lookups $table->softDeletes(); $table->timestamps(); $table->index('reference'); $table->index('type_id'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('objects'); Schema::dropIfExists('object_types'); } };