framework/db/mysql/Schema.php
public function findUniqueIndexes($table)
    {
        $sql = $this->getCreateTableSql($table);
        $uniqueIndexes = [];

        $regexp = '/UNIQUE KEY\s+\`(.+)\`\s*\((\`.+\`)+\)/mi';
        if (preg_match_all($regexp, $sql, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $match) {
                $indexName = $match[1];
                $indexColumns = array_map('trim', explode('`,`', trim($match[2], '`')));
                $uniqueIndexes[$indexName] = $indexColumns;
            }
        }

        return $uniqueIndexes;
    }
public function findUniqueIndexes($table)
    {
        $sql = $this->getCreateTableSql($table);
        $uniqueIndexes = [];

        $regexp = '/UNIQUE KEY\s+\`(.+)\`\s*\((\`.+\`)+\)/mi';
        if (preg_match_all($regexp, $sql, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $match) {
                $indexName = $match[1];
                $indexColumns = array_map('trim', explode('`,`', trim($match[2], '`')));
                $uniqueIndexes[$indexName] = $indexColumns;
            }
        }

        return $uniqueIndexes;
    }
public function findUniqueIndexes ( $ table ) { $ sql = $ this -> getCreateTableSql ( $ table ) ; $ uniqueIndexes = [ ] ; $ regexp = '/UNIQUE KEY\s+\`(.+)\`\s*\((\`.+\`)+\)/mi' ; if ( preg_match_all ( $ regexp , $ sql , $ matches , PREG_SET_ORDER ) ) { foreach ( $ matches as $ match ) { $ indexName = $ match [ 1 ] ; $ indexColumns = array_map ( 'trim' , explode ( '`,`' , trim ( $ match [ 2 ] , '`' ) ) ) ; $ uniqueIndexes [ $ indexName ] = $ indexColumns ; } } return $ uniqueIndexes ; }
Returns all unique indexes for the given table.

Each array element is of the following structure:

```php
[
'IndexName1' => ['col1' [, ...]],
'IndexName2' => ['col2' [, ...]],
]
```

@param TableSchema $table the table metadata
@return array all unique indexes for the given table.
Returns all unique indexes for the given table .