Skip to content

Commit

Permalink
[DBAL-586] Fix failures introduced by PR and adjust code.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Dec 20, 2013
1 parent 075c68b commit 894493b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
9 changes: 0 additions & 9 deletions lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
Expand Up @@ -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));

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
Expand Up @@ -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))
);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 894493b

Please sign in to comment.