summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/db/migrator.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/db/migrator.php b/lib/private/db/migrator.php
index 517be8399e8..8dbfabe443c 100644
--- a/lib/private/db/migrator.php
+++ b/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());
}