N°7968 - Renaming column can cause problem when index exists, adding a fallback to the previous method in this specific case

This commit is contained in:
jf-cbd
2026-09-02 11:45:50 +02:00
parent 59af2e8b96
commit ddc3fd8fd1

View File

@@ -241,7 +241,7 @@ abstract class ModuleInstallerAPI
}
// Simple rename
if ($sOrigTable === $sDstTable && !$bDstTableFieldExists) {
if ($sOrigTable === $sDstTable && !$bDstTableFieldExists && !CMDBSource::HasIndex($sOrigTable, $sOrigColumn)) {
$sFieldSpec = CMDBSource::GetFieldSpec($sOrigTable, $sOrigColumn);
$sQueryRename = /** @lang MariaDB */ "ALTER TABLE `{$sOrigTable}` CHANGE `{$sOrigColumn}` `{$sDstColumn}` {$sFieldSpec};";
CMDBSource::Query($sQueryRename);