Explorar el Código

Fix the upgrade schema mysql bug where alter table was being used on all numeric data types.

Mark Crane hace 13 años
padre
commit
20b4bd2a12
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  1. 11 1
      includes/lib_schema.php

+ 11 - 1
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