diff --git a/core/model/Database.php b/core/model/Database.php index 8f62b9ac5..818c3d466 100755 --- a/core/model/Database.php +++ b/core/model/Database.php @@ -175,13 +175,15 @@ abstract class Database extends Object { * if it doesn't already exist */ protected function transInitTable($table) { - if(!$this->schemaUpdateTransaction[$table]) $this->schemaUpdateTransaction[$table] = array( - 'command' => 'alter', - 'newFields' => array(), - 'newIndexes' => array(), - 'alteredFields' => array(), - 'alteredIndexes' => array(), - ); + if(!isset($this->schemaUpdateTransaction[$table])) { + $this->schemaUpdateTransaction[$table] = array( + 'command' => 'alter', + 'newFields' => array(), + 'newIndexes' => array(), + 'alteredFields' => array(), + 'alteredIndexes' => array(), + ); + } } @@ -247,6 +249,8 @@ abstract class Database extends Object { * @param string|boolean $spec The specification of the index. See requireTable() for more information. */ function requireIndex($table, $index, $spec) { + $newTable = false; + if($spec === true) { $spec = "($index)"; } @@ -277,6 +281,8 @@ abstract class Database extends Object { * @param string $spec The field specification. */ function requireField($table, $field, $spec) { + $newTable = false; + Profiler::mark('requireField'); // Collations didn't come in until MySQL 4.1. Anything earlier will throw a syntax error if you try and use // collations. diff --git a/core/model/MySQLDatabase.php b/core/model/MySQLDatabase.php index c3a346e76..5c8feda0e 100644 --- a/core/model/MySQLDatabase.php +++ b/core/model/MySQLDatabase.php @@ -178,7 +178,7 @@ class MySQLDatabase extends Database { * @param $alteredFields Updated fields, a map of field name => field schema * @param $alteredIndexes Updated indexes, a map of index name => index type */ - public function alterTable($table, $newFields, $newIndexes, $alteredFields, $alteredIndexes) { + public function alterTable($tableName, $newFields, $newIndexes, $alteredFields, $alteredIndexes) { $fieldSchemas = $indexSchemas = ""; if($newFields) foreach($newFields as $k => $v) $alterList[] .= "ADD `$k` $v";