From: Bart Visscher <bartv@thisnet.nl>
Date: Thu, 18 Jul 2013 20:19:32 +0200
Subject: When changing from a non-primary index to a primary index,
 the dropped index isn't named PRIMARY

Origin: https://github.com/doctrine/dbal/pull/363
Bug-Debian: https://bugs.debian.org/756658
---
 lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
index 1230c9b..4791f36 100644
--- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
@@ -642,6 +642,15 @@ class MySqlPlatform extends AbstractPlatform
                 }
             }
         }
+        foreach ($diff->changedIndexes as $changedKey => $changedIndex) {
+            if ($changedIndex->isPrimary() && $changedKey != 'PRIMARY') {
+                $index = $diff->changedIndexes[$changedKey];
+                $index = new Index($changedKey, $index->getColumns(), $index->isUnique(), false);
+                $diff->removedIndexes[$changedKey] = $index;
+                $diff->addedIndexes['PRIMARY'] = $diff->changedIndexes[$changedKey];
+                unset($diff->changedIndexes[$changedKey]);
+            }
+        }
 
         $sql = array_merge($sql, parent::getPreAlterTableIndexForeignKeySQL($diff));
 
