From f1cc0f1bf6d8ac68d8868be08314cde8f65c5384 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Wed, 4 Aug 2021 12:36:18 +0200 Subject: [PATCH] Remove IF EXISTS condition on rename Know that the column exists so this is unnecessary and fails in MariaDb 5.5 --- install.php | 6 ++++-- module.xml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/install.php b/install.php index 379b235..d0253ca 100644 --- a/install.php +++ b/install.php @@ -323,6 +323,7 @@ function Get_DB_config($sccp_compatible) $db_config_v4['sccpdevice'] = array_merge($db_config_v4['sccpdevice'],$db_config_v5['sccpdevice']); $db_config_v4['sccpline'] = array_merge($db_config_v4['sccpline'],$db_config_v5['sccpline']); $db_config_v4['sccpsettings'] = $db_config_v5['sccpsettings']; + dbug($db_config_v4['sccpdevice']); } return $db_config_v4; } @@ -448,14 +449,14 @@ function InstallDB_updateSchema($db_config) // Does a create exist for newName if (!empty($tab_modif[$fld_id_newName]['create'])) { //carry the attributes from the new create to the rename - $sql_rename .= "CHANGE COLUMN IF EXISTS {$fld_id} {$fld_id_newName} {$tab_modif[$fld_id_newName]['create']}, "; + $sql_rename .= "CHANGE COLUMN {$fld_id} {$fld_id_newName} {$tab_modif[$fld_id_newName]['create']}, "; // do not create newName as modifying existing unset($tab_modif[$fld_id_newName]['create']); } else { // add current attributes to the new name. $existingAttrs = strtoupper($tabl_data['Type']).(($tabl_data['Null'] == 'NO') ?' NOT NULL': ' NULL') . ((empty($tabl_data['Default']))?'': ' DEFAULT ' . "'" . $tabl_data['Default']."'"); - $sql_rename .= "CHANGE COLUMN IF EXISTS {$fld_id} {$fld_id_newName} {$existingAttrs}, "; + $sql_rename .= "CHANGE COLUMN {$fld_id} {$fld_id_newName} {$existingAttrs}, "; } unset($tab_modif[$fld_id]['rename']); $count_modify ++; @@ -496,6 +497,7 @@ function InstallDB_updateSchema($db_config) if (!empty($sql_rename)) { outn("
  • " . _("Renaming table columns ") . $tabl_name ."
  • "); $sql_rename = "ALTER TABLE {$tabl_name} " . substr($sql_rename, 0, -2); + dbug($sql_rename); try { $check = $db->query($sql_rename); } catch (\Exception $e) { diff --git a/module.xml b/module.xml index d1f771d..b0aeb58 100644 --- a/module.xml +++ b/module.xml @@ -1,7 +1,7 @@ sccp_manager SCCP Manager - 14.3.0.2 + 14.3.0.4 setup SCCP Connectivity Steve Lad, Alex GP