Bug 36986L (follow-up) Ensure idempotency

MySQL/MariaDB checks the primary key/unique constraint before WHERE
clause when performing an UPDATE. As such, the lack of AutoLocation
existing will not prevent a failure on a second run of the update.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit dc2388281c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Martin Renvoize 2024-06-05 18:10:33 +01:00 committed by Fridolin Somers
parent 6016d7eda6
commit d26bc6fba4

View file

@ -10,7 +10,7 @@ return {
$dbh->do(
q{
UPDATE systempreferences SET variable = "StaffLoginRestrictLibraryByIP"
UPDATE IGNORE systempreferences SET variable = "StaffLoginRestrictLibraryByIP"
WHERE variable = "AutoLocation"
}
) == 1
@ -18,7 +18,7 @@ return {
$dbh->do(
q{
UPDATE systempreferences SET variable = "StaffLoginLibraryBasedOnIP"
UPDATE IGNORE systempreferences SET variable = "StaffLoginLibraryBasedOnIP"
WHERE variable = "StaffLoginBranchBasedOnIP"
}
) == 1