Bugzilla – Attachment 186689 Details for
Bug 39526
Unify system preference variable names for Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39526: Do not insert the pref if renamed
Bug-39526-Do-not-insert-the-pref-if-renamed.patch (text/plain), 2.09 KB, created by
Jonathan Druart
on 2025-09-22 12:57:19 UTC
(
hide
)
Description:
Bug 39526: Do not insert the pref if renamed
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-09-22 12:57:19 UTC
Size:
2.09 KB
patch
obsolete
>From bea09a36aa7f4d1f5e60f89f04677097c65b4440 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 22 Sep 2025 14:56:22 +0200 >Subject: [PATCH] Bug 39526: Do not insert the pref if renamed > >The upgrade DB must be idempotent >if run twice, the second pass fails with >DBI Exception: DBD::mysql::db do failed: Duplicate entry 'ElasticsearchPreventAutoTruncate' for key 'PRIMARY' at /kohadevbox/koha/C4/Installer.pm line 825 > >We should not insert the pref if it has been renamed already. >--- > installer/data/mysql/db_revs/231200017.pl | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > >diff --git a/installer/data/mysql/db_revs/231200017.pl b/installer/data/mysql/db_revs/231200017.pl >index 3214e9217ec..262c328b0c0 100755 >--- a/installer/data/mysql/db_revs/231200017.pl >+++ b/installer/data/mysql/db_revs/231200017.pl >@@ -6,12 +6,18 @@ return { > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; >- $dbh->do( >- q{ >+ my ($pref_exists) = $dbh->selectrow_array( >+ q{SELECT COUNT(*) FROM systempreferences WHERE variable = 'ElasticsearchPreventAutoTruncate'}); >+ >+ # The pref is renamed in 250600017.pl, do not insert it if it has been renamed already >+ unless ($pref_exists) { >+ $dbh->do( >+ q{ > INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) > VALUES ('ESPreventAutoTruncate', 'barcode|control-number|control-number-identifier|date-of-acquisition|date-of-publication|date-time-last-modified|identifier-standard|isbn|issn|itype|lc-card-number|number-local-acquisition|other-control-number|record-control-number', NULL, 'List of searchfields (separated by | or ,) that should not be autotruncated by Elasticsearch even if QueryAutoTruncate is set to Yes', 'Free') > } >- ); >- say $out "Added new system preference 'ESPreventAutoTruncate'"; >+ ); >+ say $out "Added new system preference 'ESPreventAutoTruncate'"; >+ } > }, > }; >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39526
:
181356
|
181378
|
186488
|
186489
| 186689