From 413232a7e44056e29e15ae989ca5f08c71653725 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 19 Jul 2012 08:58:54 +0000 Subject: [PATCH] Fix the upgrade schema mysql bug where alter table was being used on all numeric data types. --- includes/lib_schema.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/lib_schema.php b/includes/lib_schema.php index cb0025a564..cd831fe281 100644 --- a/includes/lib_schema.php +++ b/includes/lib_schema.php @@ -416,7 +416,17 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { } } if ($db_type == "mysql") { - $sql_update .= "ALTER TABLE ".$table_name." modify ".$field_name." ".$field_type.";\n"; + $type = explode("(", $db_field_type); + if ($type[0] == $field_type) { + //do nothing + } + elseif ($field_type == "numeric" && $type[0] == "decimal") { + //do nothing + } + else { + $sql_update .= "ALTER TABLE ".$table_name." modify ".$field_name." ".$field_type.";\n"; + } + unset($type); } if ($db_type == "sqlite") { //a change has been made to the field type