1
0
mirror of synced 2024-12-13 22:56:04 +03:00

unique index support added

This commit is contained in:
zYne 2007-02-10 14:41:24 +00:00
parent 855ee3a8e3
commit eef58aff4b

View File

@ -252,8 +252,20 @@ class Doctrine_Export extends Doctrine_Connection_Module
{ {
$table = $this->conn->quoteIdentifier($table); $table = $this->conn->quoteIdentifier($table);
$name = $this->conn->quoteIdentifier($name); $name = $this->conn->quoteIdentifier($name);
$type = '';
if(isset($definition['type'])) {
switch (strtolower($definition['type'])) {
case 'unique':
$type = strtoupper($definition['type']) . ' ';
break;
default:
throw new Doctrine_Export_Exception('Unknown index type ' . $definition['type']);
}
}
$query = 'CREATE ' . $type . 'INDEX ' . $name . ' ON ' . $table;
$query = 'CREATE INDEX ' . $name . ' ON ' . $table;
$fields = array(); $fields = array();
foreach (array_keys($definition['fields']) as $field) { foreach (array_keys($definition['fields']) as $field) {
$fields[] = $this->conn->quoteIdentifier($field); $fields[] = $this->conn->quoteIdentifier($field);