mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
⚡️ Add faster way to rename column on the same table (#676)
* Add faster way to rename column on the same table
This commit is contained in:
@@ -272,6 +272,17 @@ abstract class ModuleInstallerAPI
|
||||
return;
|
||||
}
|
||||
|
||||
// Simple rename
|
||||
if ($sOrigTable === $sDstTable && !$bDstTableFieldExists)
|
||||
{
|
||||
$sFieldSpec = CMDBSource::GetFieldSpec($sOrigTable, $sOrigColumn);
|
||||
$sQueryRename = /** @lang MariaDB */ "ALTER TABLE `{$sOrigTable}` CHANGE `{$sOrigColumn}` `{$sDstColumn}` {$sFieldSpec};";
|
||||
CMDBSource::Query($sQueryRename);
|
||||
|
||||
CMDBSource::CacheReset($sOrigTable);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the destination field if necessary
|
||||
if($bDstTableFieldExists === false){
|
||||
$sSpec = CMDBSource::GetFieldSpec($sOrigTable, $sOrigColumn);
|
||||
|
||||
Reference in New Issue
Block a user