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".
remotes/origin/ldap_group_count
Vincent Petry 11 years ago
parent 4fbab3c12d
commit 7aa11b4361
  1. 8
      lib/private/db/migrator.php

@ -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());
}

Loading…
Cancel
Save