Skip to content
Snippets Groups Projects
Commit 7aa11b43 authored by Vincent Petry's avatar Vincent Petry
Browse files

Do not rename primary key index when renaming table

When the migrator renames a table, for example for upgrade simulation,
it should not rename the primary key to avoid messing up with the diff
because the MySQL Doctrine code expects that index to always be called
"primary".
parent 4fbab3c1
No related branches found
No related tags found
No related merge requests found
......@@ -128,7 +128,13 @@ class Migrator {
$indexes = $table->getIndexes();
$newIndexes = array();
foreach ($indexes as $index) {
$indexName = 'oc_' . uniqid(); // avoid conflicts in index names
if ($index->isPrimary()) {
// do not rename primary key
$indexName = $index->getName();
} else {
// avoid conflicts in index names
$indexName = 'oc_' . uniqid();
}
$newIndexes[] = new Index($indexName, $index->getColumns(), $index->isUnique(), $index->isPrimary());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment