summaryrefslogtreecommitdiffstats
path: root/php-doctrine-dbal-2.4.2-primary_index.patch
diff options
context:
space:
mode:
Diffstat (limited to 'php-doctrine-dbal-2.4.2-primary_index.patch')
-rw-r--r--php-doctrine-dbal-2.4.2-primary_index.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/php-doctrine-dbal-2.4.2-primary_index.patch b/php-doctrine-dbal-2.4.2-primary_index.patch
new file mode 100644
index 0000000..49d46a0
--- /dev/null
+++ b/php-doctrine-dbal-2.4.2-primary_index.patch
@@ -0,0 +1,32 @@
+From 1d729298ee9464e03a4695f2df0e63b15d10874c Mon Sep 17 00:00:00 2001
+From: Bart Visscher <bartv@thisnet.nl>
+Date: Thu, 18 Jul 2013 20:19:32 +0200
+Subject: [PATCH] When changing from a non-primary index to a primary index,
+ the dropped index isnt named PRIMARY
+
+---
+ doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+index 8050e1f..d77b974 100644
+--- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
++++ b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+@@ -512,6 +512,15 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
+ }
+ }
+ }
++ 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));
+
+--
+1.8.5.1