N°8419 - Improve Setup process by avoiding the update of the attachment table when contact_id is already set

This commit is contained in:
Benjamin Dalsass
2025-07-16 09:35:19 +02:00
committed by Benjamin Dalsass
parent 700470dd29
commit 1438006861

View File

@@ -201,7 +201,7 @@ SQL;
}
SetupLog::Info("Initializing attachment/item_org_id - $iUpdated records have been adjusted");
if (MetaModel::GetAttributeDef('Attachment', 'contact_id') instanceof AttributeExternalKey) {
if (MetaModel::GetAttributeDef('Attachment', 'contact_id') instanceof AttributeExternalKey && version_compare($sPreviousVersion, '3.2.0', '<')) {
SetupLog::Info("Upgrading itop-attachment from '$sPreviousVersion' to '$sCurrentVersion'. Starting with 3.2.0, contact_id will be added into the DB...");
$sUserTableName = MetaModel::DBGetTable('User');
$sUserFieldContactId = MetaModel::GetAttributeDef('User', 'contactid')->Get('sql');