some fixes to get update from ancient EGroupware 1.4 working again

This commit is contained in:
ralf 2023-10-18 21:35:39 +03:00
parent 776da1bd54
commit bfb7d1b516
3 changed files with 8 additions and 1 deletions

View File

@ -822,6 +822,7 @@ class Db
if (in_array($e->getCode(), [ if (in_array($e->getCode(), [
1064, // You have an error in your SQL syntax 1064, // You have an error in your SQL syntax
1062, // Duplicate entry 1062, // Duplicate entry
1054, // Unknown column 'X' in 'field list'
])) ]))
{ {
throw new Db\Exception\InvalidSql($e->getMessage(), $e->getCode(), $e); throw new Db\Exception\InvalidSql($e->getMessage(), $e->getCode(), $e);

View File

@ -1164,6 +1164,12 @@ class Schema
} }
break; break;
case 'decimal': 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])"; $ado_col = "N($col_data[precision].$col_data[scale])";
break; break;
case 'double': case 'double':

View File

@ -536,7 +536,7 @@ class setup
'app_name' => $appname, 'app_name' => $appname,
], __LINE__, __FILE__); ], __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 // ease update from pre 1.6 eg. 1.4 not having app_index, app_icon, app_icon_app columns
_egw_log_exception($e); _egw_log_exception($e);