mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fixed bugs in db/build (merged from gsoc branch, r40402)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@40408 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
23dab38035
commit
ff00abd449
@ -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.
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user