yii\db\pgsql\Schema::getUniqueIndexInformation PHP Method

getUniqueIndexInformation() protected method

Gets information about given table unique indexes.
protected getUniqueIndexInformation ( yii\db\TableSchema $table ) : array
$table yii\db\TableSchema the table metadata
return array with index and column names
    protected function getUniqueIndexInformation($table)
    {
        $sql = <<<SQL
SELECT
    i.relname as indexname,
    pg_get_indexdef(idx.indexrelid, k + 1, TRUE) AS columnname
FROM (
  SELECT *, generate_subscripts(indkey, 1) AS k
  FROM pg_index
) idx
INNER JOIN pg_class i ON i.oid = idx.indexrelid
INNER JOIN pg_class c ON c.oid = idx.indrelid
INNER JOIN pg_namespace ns ON c.relnamespace = ns.oid
WHERE idx.indisprimary = FALSE AND idx.indisunique = TRUE
AND c.relname = :tableName AND ns.nspname = :schemaName
ORDER BY i.relname, k
SQL;
        return $this->db->createCommand($sql, [':schemaName' => $table->schemaName, ':tableName' => $table->name])->queryAll();
    }