diff --git a/src/Relation/HasOne.php b/src/Relation/HasOne.php index ff2d2a0..6332e39 100644 --- a/src/Relation/HasOne.php +++ b/src/Relation/HasOne.php @@ -83,7 +83,7 @@ public function render(Registry $registry): void $table = $registry->getTableSchema($target); if ($this->options->get(self::INDEX_CREATE)) { - $table->index([$outerField->getColumn()]); + $table->index([$outerField->getColumn()])->unique(); } if ($this->options->get(self::FK_CREATE)) {