From 57be50bf2228c19d7cb777d183aa80e430346ebf Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Mon, 15 Dec 2025 18:03:44 +0100 Subject: [PATCH] MT#64020 fix 15797 to avoid restoring valid peer prefs * this fix addresses voip_peer_preferences default values restoration in 15797 and it from now on only restores missing default values for preferences that do not have peer_pref with non default value NULL, so that scenarios where a preference does not exists in voip_peer_preference because it was manually selected by the customer with the value NULL so it does not exists in voip_peer_preferences for that reason. Change-Id: I83ee3294cab896679575187066a3960818dc2f77 (cherry picked from commit 5b840a69e75a3712177f198f7bf4516d65b88470) --- db_scripts/diff/15797.up | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/db_scripts/diff/15797.up b/db_scripts/diff/15797.up index d8c840cd..71557bf8 100644 --- a/db_scripts/diff/15797.up +++ b/db_scripts/diff/15797.up @@ -48,4 +48,11 @@ SELECT ph.id, p.id, pe.value JOIN voip_peer_hosts ph LEFT OUTER JOIN voip_peer_preferences pp ON pp.attribute_id = p.id AND ph.id = pp.peer_host_id WHERE p.peer_pref = 1 AND pe.peer_pref = 1 AND pe.default_val = 1 AND pe.value IS NOT NULL - AND pp.value IS NULL; + AND pp.value IS NULL + AND NOT EXISTS ( + SELECT id FROM voip_preferences_enum pn + WHERE pn.preference_id = p.id + AND pn.peer_pref = 1 + AND pn.default_val = 0 + AND pn.value IS NULL + LIMIT 1);