Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/06a15b4b47a56e4c9163 to your computer and use it in GitHub Desktop.
Save doctrinebot/06a15b4b47a56e4c9163 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DBAL-285 - https://github.com/doctrine/dbal/issues/1465
diff --git a/lib/Doctrine/DBAL/Schema/Table.php b/lib/Doctrine/DBAL/Schema/Table.php
--- a/lib/Doctrine/DBAL/Schema/Table.php
+++ b/lib/Doctrine/DBAL/Schema/Table.php
@@ -133,13 +133,15 @@ class Table extends AbstractAsset
*/
public function setPrimaryKey(array $columns, $indexName = false)
{
- $primaryKey = $this->_createIndex($columns, $indexName ?: "primary", true, true);
-
+ $unquotedColumns = array();
foreach ($columns AS $columnName) {
$column = $this->getColumn($columnName);
$column->setNotnull(true);
+ $unquotedColumns[] = $column->getName();
}
+ $primaryKey = $this->_createIndex($unquotedColumns, $indexName ?: "primary", true, true);
+
return $primaryKey;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment