From 757641d0bd655071b4c5b27cd208af7f59a8a0aa Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Mon, 17 Feb 2014 17:12:33 +0000 Subject: [PATCH] Fix upgrade schema so it evaluate char and char(30) as a char. --- resources/schema.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/schema.php b/resources/schema.php index f9ea1681f0..9c555f17b8 100644 --- a/resources/schema.php +++ b/resources/schema.php @@ -436,7 +436,9 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { //change the data type if it has been changed //if the data type in the app db array is different than the type in the database then change the data type $db_field_type = db_column_data_type ($db, $db_type, $db_name, $table_name, $field_name); - if ($db_field_type != $field_type) { + $field_type_array = explode("(", $field_type); + $field_type = $field_type_array[0]; + if (trim($db_field_type) != trim($field_type)) { if ($db_type == "pgsql") { if (strtolower($field_type) == "uuid") { $sql_update .= "ALTER TABLE ".$table_name." ALTER COLUMN ".$field_name." TYPE uuid USING\n"; @@ -448,7 +450,11 @@ function db_upgrade_schema ($db, $db_type, $db_name, $display_results) { //field type has not changed } elseif ($db_field_type = "timestamp without time zone" && strtolower($field_type) == "timestamp") { //field type has not changed - } elseif ($db_field_type = "character" && strtolower($field_type) == "char(1)") { + } elseif ($db_field_type = "timestamp without time zone" && strtolower($field_type) == "datetime") { + //field type has not changed + } elseif ($db_field_type = "integer" && strtolower($field_type) == "numeric") { + //field type has not changed + } elseif ($db_field_type = "character" && strtolower($field_type) == "char") { //field type has not changed } else {