Skip to content

Commit

Permalink
Add faster way to rename column on the same table
Browse files Browse the repository at this point in the history
  • Loading branch information
Hipska committed Mar 21, 2024
1 parent a93d5b8 commit 6021ffd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions setup/moduleinstaller.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ public static function MoveColumnInDB($sOrigTable, $sOrigColumn, $sDstTable, $sD
return;
}

// Simple rename
if ($sOrigTable === $sDstTable)
{
$sQueryRename = /** @lang MySQL */ "ALTER TABLE `{$sOrigTable}` RENAME COLUMN `{$sOrigColumn}` TO `{$sDstColumn}`;";
CMDBSource::Query($sQueryRename);

CMDBSource::CacheReset($sOrigTable);
return;
}

// Create the destination field if necessary
if($bDstTableFieldExists === false){
$sSpec = CMDBSource::GetFieldSpec($sOrigTable, $sOrigColumn);
Expand Down

0 comments on commit 6021ffd

Please sign in to comment.