protected function createIndex(Schema $schema, $tableName, array $columns, $indexName, array $length = array())
{
if (!$schema->hasTable($tableName)) {
return false;
}
$table = $schema->getTable($tableName);
if (!$table->hasIndex($indexName)) {
if ($this->connection->getDatabasePlatform()->getName() == "mysql" && !empty($length)) {
$cols = array();
foreach ($length as $column => $len) {
$cols[] = sprintf('%s(%d)', $column, $len);
}
$this->addSql('CREATE INDEX ' . $indexName . ' ON ' . $tableName . '(' . implode(', ', $cols) . ');');
} else {
$table->addIndex($columns, $indexName);
}
return true;
}
return false;
}