From a0104bf8197db182efa61582e2b00def1881aa1d Mon Sep 17 00:00:00 2001
From: Grevil <js@webks.de>
Date: Tue, 4 Jun 2024 13:39:22 +0200
Subject: [PATCH] Only update storage entity settings if they changed

---
 core/modules/field/field.install | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/core/modules/field/field.install b/core/modules/field/field.install
index dd1e8cea02ea..6e59f4c12e92 100644
--- a/core/modules/field/field.install
+++ b/core/modules/field/field.install
@@ -42,9 +42,12 @@ function field_update_10001() {
     // Set the new scale value:
     $newScaleValue = $scaleValue > $castedInitialPrecisionValue ? $castedInitialPrecisionValue : $scaleValue;
 
-    // Set the new precision and scale values and save the entity:
-    $decimalFieldStorageEntity->setSetting('precision', $newPrecisionValue);
-    $decimalFieldStorageEntity->setSetting('scale', $newScaleValue);
-    $decimalFieldStorageEntity->save();
+    // Set the new precision and scale values if they changed:
+    if ($precisionValue != $newPrecisionValue || $scaleValue != $newScaleValue) {
+      $decimalFieldStorageEntity->setSetting('precision', $newPrecisionValue);
+      $decimalFieldStorageEntity->setSetting('scale', $newScaleValue);
+      $decimalFieldStorageEntity->save();
+    }
+
   }
 }
-- 
GitLab