protected function index($name, $columns = null, $using = null)
{
// return the cached index query object
if (isset($this->indexes[$name])) {
return $this->indexes[$name];
}
$query = $this->indexes[$name] = new CreateIndexQuery($name);
if ($columns) {
if (!$columns || empty($columns)) {
throw new InvalidArgumentException('index columns must not be empty.');
}
$query->on($this->getTable(), (array) $columns);
}
if ($using) {
$query->using($using);
}
return $query;
}