[Pkg-owncloud-commits] [owncloud] 183/223: Do not rename primary key index when renaming table

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:54:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 7aa11b436145b9b5d1cef2fb88725d81729aab20
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue Jun 17 14:11:02 2014 +0200

    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".
---
 lib/private/db/migrator.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/private/db/migrator.php b/lib/private/db/migrator.php
index 517be83..8dbfabe 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());
 		}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list