From bfb7d1b5162254160043abfbaef76fd92ab74cd8 Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 18 Oct 2023 21:35:39 +0300 Subject: [PATCH] some fixes to get update from ancient EGroupware 1.4 working again --- api/src/Db.php | 1 + api/src/Db/Schema.php | 6 ++++++ setup/inc/class.setup.inc.php | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/Db.php b/api/src/Db.php index 729fbd38a5..6c713c9fc3 100644 --- a/api/src/Db.php +++ b/api/src/Db.php @@ -822,6 +822,7 @@ class Db if (in_array($e->getCode(), [ 1064, // You have an error in your SQL syntax 1062, // Duplicate entry + 1054, // Unknown column 'X' in 'field list' ])) { throw new Db\Exception\InvalidSql($e->getMessage(), $e->getCode(), $e); diff --git a/api/src/Db/Schema.php b/api/src/Db/Schema.php index 8ec20f0a7c..9427a08ebb 100644 --- a/api/src/Db/Schema.php +++ b/api/src/Db/Schema.php @@ -1164,6 +1164,12 @@ class Schema } break; case 'decimal': + // some old and broken backups have that for timestamps, as it's invalid anyway (scale < 0), we translate it to timestamp + if ($col_data['precision'] === -1 && empty($col_data['scale'])) + { + $ado_col = 'T'; + break; + } $ado_col = "N($col_data[precision].$col_data[scale])"; break; case 'double': diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index 81cef749c1..a584d00fbc 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -536,7 +536,7 @@ class setup 'app_name' => $appname, ], __LINE__, __FILE__); } - catch (Api\Db\Exception\InvalidSql $e) + catch (Api\Db\Exception $e) { // ease update from pre 1.6 eg. 1.4 not having app_index, app_icon, app_icon_app columns _egw_log_exception($e);