Don't asume that table and column exist in the migration process.

Just to avoid some warnings.
This commit is contained in:
stronk7 2006-09-02 23:38:16 +00:00
parent 1331745826
commit ec87d0474f

View File

@ -473,10 +473,10 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
Note that this code will leave remaining NOT NULL fiels Note that this code will leave remaining NOT NULL fiels
unmodified at all, folowing the old approach unmodified at all, folowing the old approach
*/ */
$cols = $db->MetaColumns($prefix.$dbtablename); if($cols = $db->MetaColumns($prefix.$dbtablename)) {
$cols = array_change_key_case($cols, CASE_LOWER); ///lowercase col names $cols = array_change_key_case($cols, CASE_LOWER); ///lowercase col names
$notnull = 'NOT NULL'; ///Old default $notnull = 'NOT NULL'; ///Old default
$col = $cols[strtolower($fieldname)]; if ($col = $cols[strtolower($fieldname)]) {
/// If the column was null before UTF-8 migration, save it /// If the column was null before UTF-8 migration, save it
if (!$col->not_null) { if (!$col->not_null) {
$notnull = 'NULL'; $notnull = 'NULL';
@ -485,6 +485,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
$default = 'NULL'; $default = 'NULL';
} }
} }
}
}
/* Change to longblob, serves 2 purposes: /* Change to longblob, serves 2 purposes:
1. column loses encoding, so when we finally change it to unicode, 1. column loses encoding, so when we finally change it to unicode,