Modify installer db calls to remove IF EXISTS

IF EXISTS is not correct in MariaDb v5, used in all FreePbx Packages.
This commit is contained in:
stevenA 2022-01-16 16:04:41 +01:00
parent b1769e6378
commit 546de5add1
2 changed files with 4 additions and 3 deletions

View file

@ -433,7 +433,7 @@ function InstallDB_updateSchema($db_config)
} }
// Processed all _Column names; now safe to delete them // Processed all _Column names; now safe to delete them
$sqlDrop = array_reduce($fieldsArr, function($carry, $column) { $sqlDrop = array_reduce($fieldsArr, function($carry, $column) {
return "${carry} DROP COLUMN IF EXISTS ${column},"; return "${carry} DROP COLUMN ${column},";
}); });
$sqlDrop = rtrim($sqlDrop, ", "); $sqlDrop = rtrim($sqlDrop, ", ");
$stmt = $db->prepare("ALTER TABLE ${table} ${sqlDrop}"); $stmt = $db->prepare("ALTER TABLE ${table} ${sqlDrop}");
@ -463,7 +463,7 @@ function InstallDB_updateSchema($db_config)
// occur as columns that are dropped should no longer be in the module.xml schema // occur as columns that are dropped should no longer be in the module.xml schema
// and so Doctrine will have already dropped them. // and so Doctrine will have already dropped them.
if (!empty($tab_modif[$fld_id]['drop'])) { if (!empty($tab_modif[$fld_id]['drop'])) {
$sql_create .= "DROP COLUMN IF EXISTS {$row_fld}, "; $sql_create .= "DROP COLUMN {$row_fld}, ";
unset($tab_modif[$fld_id]['drop']); unset($tab_modif[$fld_id]['drop']);
continue; continue;
} }

View file

@ -1,7 +1,7 @@
<module> <module>
<rawname>sccp_manager</rawname> <rawname>sccp_manager</rawname>
<name>SCCP Manager</name> <name>SCCP Manager</name>
<version>14.4.0.1</version> <version>14.4.0.2</version>
<type>setup</type> <type>setup</type>
<category>SCCP Connectivity</category> <category>SCCP Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher> <publisher>Steve Lad, Alex GP</publisher>
@ -38,6 +38,7 @@
* Version 14.3.0.30 * - Fix reversion in 29. Not returning to correct page when saving device. * Version 14.3.0.30 * - Fix reversion in 29. Not returning to correct page when saving device.
* Version 14.3.0.31 * - Fix rewrite rules. * Version 14.3.0.31 * - Fix rewrite rules.
* Version 14.4.0.1 * - Modify installer to avoid data loss on existing 14.3 fields. Bump Minor version to reflect this. * Version 14.4.0.1 * - Modify installer to avoid data loss on existing 14.3 fields. Bump Minor version to reflect this.
* Version 14.4.0.2 * - Revert error in Installer db calls - IF EXISTS is not valid in MariaDb v5 (package DB)
</changelog> </changelog>
<location>https://github.com/chan-sccp/sccp_manager</location> <location>https://github.com/chan-sccp/sccp_manager</location>
<depends> <depends>