Index
Less than 1 minute
Index
Trait providing index management methods for SQL-based DBI drivers.
trait IndexIncludes default implementations for listing, creating, dropping, and checking indexes.
Methods
listIndexes
Retrieves a list of indexes for a given table or all tables in the specified schema.
public listIndexes(?string $tableName, false $): voidParameters
| Parameter | Type | Description |
|---|---|---|
$tableName | string | The name of the table. If null, all tables in the schema will be considered. |
$ | false |
indexExists
Check if an index exists by name for a given table.
public indexExists(string $indexName, ?string $tableName): boolParameters
| Parameter | Type | Description |
|---|---|---|
$indexName | string | the name of the index to check |
$tableName | string | the name of the table (optional) |
createIndex
Attempt to create an index on a table.
public createIndex(string $indexName, string $tableName, mixed $idxInfo): boolParameters
| Parameter | Type | Description |
|---|---|---|
$indexName | string | the name of the index to create |
$tableName | string | the name of the table |
$idxInfo | mixed | Index definition (columns, uniqueness, type, etc.). |
dropIndex
Attempt to drop an index by name.
public dropIndex(string $indexName, bool $ifExists): boolParameters
| Parameter | Type | Description |
|---|---|---|
$indexName | string | the name of the index to drop |
$ifExists | bool | if true, do not error if the index does not exist |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:24 +0000