From eef58aff4b80182c0ef24ca1a60fbce5a4277043 Mon Sep 17 00:00:00 2001 From: zYne Date: Sat, 10 Feb 2007 14:41:24 +0000 Subject: [PATCH] unique index support added --- lib/Doctrine/Export.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/Export.php index 6a5b79118..4d7bb8d8e 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/Export.php @@ -252,8 +252,20 @@ class Doctrine_Export extends Doctrine_Connection_Module { $table = $this->conn->quoteIdentifier($table); $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(); foreach (array_keys($definition['fields']) as $field) { $fields[] = $this->conn->quoteIdentifier($field);