summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-17 14:11:02 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-17 15:23:18 +0200
commit7aa11b436145b9b5d1cef2fb88725d81729aab20 (patch)
tree941c2a92737bdb0872d388935ff4675d34f1fa50 /lib
parent4fbab3c12db8bc23c7a4891005c00f6f302ae9e3 (diff)
downloadnextcloud-server-7aa11b436145b9b5d1cef2fb88725d81729aab20.tar.gz
nextcloud-server-7aa11b436145b9b5d1cef2fb88725d81729aab20.zip
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".
Diffstat (limited to 'lib')
-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());
}