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();
}