Permalink
Browse files

Implement getUniqueConstraintDeclarationSQL function.

  • Loading branch information...
1 parent f276c65 commit 4cf1deedf870014466620fa8599f5cfff1034865 @posulliv committed Aug 23, 2012
Showing with 18 additions and 10 deletions.
  1. +18 −10 lib/Doctrine/DBAL/Platforms/AkibanServerPlatform.php
View
28 lib/Doctrine/DBAL/Platforms/AkibanServerPlatform.php
@@ -19,7 +19,8 @@
namespace Doctrine\DBAL\Platforms;
-use Doctrine\DBAL\Schema\TableDiff,
+use Doctrine\DBAL\Schema\Index,
+ Doctrine\DBAL\Schema\TableDiff,
Doctrine\DBAL\Schema\Table;
/**
@@ -384,6 +385,18 @@ public function getDropSequenceSQL($sequence)
return "DROP SEQUENCE " . $sequence . " RESTRICT";
}
+ /**
+ * @override
+ */
+ public function getUniqueConstraintDeclarationSQL($name, Index $index)
+ {
+ // TODO - akiban does not support speciifying names for unique constraints in 1.4.0
+
+ return " UNIQUE ("
+ . $this->getIndexFieldDeclarationListSQL($index->getColumns())
+ . ")";
+ }
+
/**
* Gets the SQL used to create a table.
*
@@ -398,7 +411,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
foreach ($options['uniqueConstraints'] as $name => $definition) {
- // TODO
+ $columnListSql .= $this->getUniqueConstraintDeclarationSQL($name, $definition);
}
}
@@ -410,8 +423,8 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
$query = "CREATE TABLE " . $tableName . " (" . $columnListSql . ")";
$check = $this->getCheckDeclarationSQL($columns);
- if ( ! empty($check)) {
- // TODO
+ if (! empty($check)) {
+ // TODO - Akiban does not support CHECK constraints in 1.4.0
}
$sql[] = $query;
@@ -420,11 +433,6 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
if (isset($column['sequence'])) {
$sql[] = $this->getCreateSequenceSQL($column['sequence'], 1);
}
-
- if (isset($column['autoincrement']) && $column['autoincrement'] ||
- (isset($column['autoinc']) && $column['autoinc'])) {
- // TODO??
- }
}
if (isset($options['indexes']) && ! empty($options['indexes'])) {
@@ -433,7 +441,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
}
}
- // TODO - foreign keys
+ // TODO - foreign keys, Akiban does not support in 1.4.0
return $sql;
}

0 comments on commit 4cf1dee

Please sign in to comment.