From 894493b285c71a33e6ed29994ba415bad5e0a457 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Fri, 20 Dec 2013 17:08:17 +0100 Subject: [PATCH] [DBAL-586] Fix failures introduced by PR and adjust code. --- lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 9 --------- .../Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index 7337cb18c7f..a48ac466394 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -642,15 +642,6 @@ 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)); diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php index fee0171bf59..e9940adc505 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php @@ -314,7 +314,7 @@ public function testAlterTableAddPrimaryKey() $diffTable->setPrimaryKey(array('id')); $this->assertEquals( - array('ALTER TABLE alter_table_add_pk DROP INDEX idx_id, ADD PRIMARY KEY (id)'), + array('DROP INDEX idx_id ON alter_table_add_pk', 'ALTER TABLE alter_table_add_pk ADD PRIMARY KEY (id)'), $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) ); } @@ -375,7 +375,7 @@ public function testNamedPrimaryKey() $sql = $this->_platform->getAlterTableSQL($diff); $this->assertEquals(array( - "DROP INDEX foo_index ON mytable", + "ALTER TABLE mytable DROP PRIMARY KEY", "ALTER TABLE mytable ADD PRIMARY KEY (foo)", ), $sql); }