diff --git a/lib/private/DB/Schema/Table.php b/lib/private/DB/Schema/Table.php index 7f3e6db8015..d8b99cfa5ce 100644 --- a/lib/private/DB/Schema/Table.php +++ b/lib/private/DB/Schema/Table.php @@ -256,6 +256,11 @@ class Table implements ITable { )); } + #[\Override] + public function getIndex(string $name): IIndex { + return new Index($this->table->getIndex($name)); + } + #[\Override] public function getForeignKeys(): array { return array_values(array_map( diff --git a/lib/public/DB/Schema/ITable.php b/lib/public/DB/Schema/ITable.php index e6cde299f81..35311b02690 100644 --- a/lib/public/DB/Schema/ITable.php +++ b/lib/public/DB/Schema/ITable.php @@ -201,6 +201,15 @@ interface ITable { */ public function getIndexes(): array; + /** + * Returns a specific index by name of this table. + * + * @param non-empty-string $name The index name. + * @return IIndex + * @since 35.0.0 + */ + public function getIndex(string $name): IIndex; + /** * Adds a foreign key constraint. *