MINOR Fixed Database class PHP notices caused by a missing array index when running dev/build to create a new table

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72750 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-03-10 02:02:14 +00:00
parent 8960c03376
commit c5d1a53281

View File

@ -299,10 +299,13 @@ abstract class Database extends Object {
//Fix up the index for database purposes //Fix up the index for database purposes
$index=DB::getConn()->getDbSqlDefinition($table, $index, null, true); $index=DB::getConn()->getDbSqlDefinition($table, $index, null, true);
if(is_array($this->indexList[$table][$index])) if(!$newTable) {
$array_spec=$this->indexList[$table][$index]['spec']; if(is_array($this->indexList[$table][$index])) {
else $array_spec = $this->indexList[$table][$index]['spec'];
$array_spec=$this->indexList[$table][$index]; } else {
$array_spec = $this->indexList[$table][$index];
}
}
if($newTable || !isset($this->indexList[$table][$index])) { if($newTable || !isset($this->indexList[$table][$index])) {
$this->transCreateIndex($table, $index, $spec); $this->transCreateIndex($table, $index, $spec);
@ -362,9 +365,13 @@ abstract class Database extends Object {
if($spec_orig==DB::getConn()->IdColumn()) if($spec_orig==DB::getConn()->IdColumn())
$specValue=DB::getConn()->IdColumn(true); $specValue=DB::getConn()->IdColumn(true);
if(is_array($this->fieldList[$table][$field])) if(!$newTable) {
$fieldValue=$this->fieldList[$table][$field]['data_type']; if(is_array($this->fieldList[$table][$field])) {
else $fieldValue=$this->fieldList[$table][$field]; $fieldValue = $this->fieldList[$table][$field]['data_type'];
} else {
$fieldValue = $this->fieldList[$table][$field];
}
}
// Get the version of the field as we would create it. This is used for comparison purposes to see if the // Get the version of the field as we would create it. This is used for comparison purposes to see if the
// existing field is different to what we now want // existing field is different to what we now want