function createIndex($name, $table, $columns, $type, $unique, $where, $tablespace, $concurrently)
{
$f_schema = $this->_schema;
$this->fieldClean($f_schema);
$this->fieldClean($name);
$this->fieldClean($table);
$sql = "CREATE";
if ($unique) {
$sql .= " UNIQUE";
}
$sql .= " INDEX";
if ($concurrently) {
$sql .= " CONCURRENTLY";
}
$sql .= " \"{$name}\" ON \"{$f_schema}\".\"{$table}\" USING {$type} ";
if (is_array($columns)) {
$this->arrayClean($columns);
$sql .= "(\"" . implode('","', $columns) . "\")";
} else {
$sql .= "(" . $columns . ")";
}
// Tablespace
if ($this->hasTablespaces() && $tablespace != '') {
$this->fieldClean($tablespace);
$sql .= " TABLESPACE \"{$tablespace}\"";
}
// Predicate
if (trim($where) != '') {
$sql .= " WHERE ({$where})";
}
return $this->execute($sql);
}