From e81f11cc60cbee7425d27a560e03d499717e2628 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 14 Oct 2010 03:53:43 +0000 Subject: [PATCH] ENHANCEMENT MySQLDatabase::renameField() no longer checks that the field exists in fieldList(). alterField() does no such check, so it should be consistent. Removing this should provide a small performance improvement as well git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@112272 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/MySQLDatabase.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/model/MySQLDatabase.php b/core/model/MySQLDatabase.php index 0eb9c3c5e..916e289ab 100755 --- a/core/model/MySQLDatabase.php +++ b/core/model/MySQLDatabase.php @@ -321,10 +321,7 @@ class MySQLDatabase extends SS_Database { * @param string $newName The new name of the field */ public function renameField($tableName, $oldName, $newName) { - $fieldList = $this->fieldList($tableName); - if(array_key_exists($oldName, $fieldList)) { - $this->query("ALTER TABLE \"$tableName\" CHANGE \"$oldName\" \"$newName\" " . $fieldList[$oldName]); - } + $this->query("ALTER TABLE \"$tableName\" CHANGE \"$oldName\" \"$newName\" " . $fieldList[$oldName]); } private static $_cache_collation_info = array();