1
0
mirror of synced 2024-12-13 22:56:04 +03:00
This commit is contained in:
zYne 2007-02-10 14:10:51 +00:00
parent b29a0340dd
commit 99edf66af4

View File

@ -384,12 +384,25 @@ class Doctrine_Export_Mysql extends Doctrine_Export
* @throws PDOException
* @return void
*/
public function createIndex($table, $name, array $definition)
public function createIndex($table, $name, array $definition, $type = null)
{
$table = $table;
$name = $this->conn->getIndexName($name);
$query = 'CREATE INDEX ' . $name . ' ON ' . $table;
if(isset($type)) {
switch (strtolower($type)) {
case 'fulltext':
case 'unique':
$type = strtoupper($type) . ' ';
break;
default:
throw new Doctrine_Export_Exception('Unknown index type ' . $type);
}
}
$query = 'CREATE ' . $type . 'INDEX ' . $name . ' ON ' . $table;
$fields = array();
foreach ($definition['fields'] as $field => $fieldinfo) {
if (!empty($fieldinfo['length'])) {
$fields[] = $field . '(' . $fieldinfo['length'] . ')';