Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:51
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/90f981a01b4f4e662542 to your computer and use it in GitHub Desktop.
Save doctrinebot/90f981a01b4f4e662542 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DBAL-120 - https://github.com/doctrine/dbal/issues/1145
--- Platforms/MySqlPlatform.old.php 2011-05-13 16:33:41.000000000 -0500
+++ Platforms/MySqlPlatform.php 2011-05-13 16:31:42.000000000 -0500
@@ -425,12 +425,12 @@
foreach ($diff->changedColumns AS $columnDiff) {
/* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
$column = $columnDiff->column;
- $queryParts[] = 'CHANGE ' . ($columnDiff->oldColumnName) . ' '
+ $queryParts[] = 'CHANGE ' . $this->quoteIdentifier($columnDiff->oldColumnName) . ' '
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}
foreach ($diff->renamedColumns AS $oldColumnName => $column) {
- $queryParts[] = 'CHANGE ' . $oldColumnName . ' '
+ $queryParts[] = 'CHANGE ' . $this->quoteIdentifier($oldColumnName) . ' '
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}
--- Platforms/MySqlPlatform.old2.php 2011-05-13 17:01:00.000000000 -0500
+++ Platforms/MySqlPlatform.php 2011-05-13 17:03:38.000000000 -0500
@@ -357,7 +357,10 @@
// attach all primary keys
if (isset($options['primary']) && ! empty($options['primary'])) {
- $keyColumns = array_unique(array_values($options['primary']));
+ $keyColumns = array();
+ foreach(array_unique(array_values($options['primary'])) as $keyColumn) {
+ $keyColumns[] = $this->quoteIdentifier($keyColumn);
+ }
$queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment