Bug 39460: Fix koha-upgrade-schema when no DB change needed

This patch fixes koha-upgrade-schema so that it returns an exit
code of 0 whether or not a DB change is needed. This is important
so that koha-common.postinst proceeds correctly even when there
is no DB change needed (e.g. for 24.11.03-2)

Test plan:
0. Apply the patch
1. cp debian/scripts/koha-upgrade-schema /usr/sbin/koha-upgrade-schema
2. dpkg-reconfigure koha-common
3. Note the process completes correctly
4. koha-upgrade-schema kohadev
5. Note following text appears very quickly:
Upgrading database schema for kohadev
No database change required
6. koha-mysql kohadev
update systempreferences set value = '24.1102000' where variable = 'Version';
7. Clear memcached
8. koha-upgrade-schema kohadev
9. Note that it applies the 24.11.03 database upgrade

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
David Cook 2025-04-01 01:52:27 +00:00 committed by Katrin Fischer
parent 38d9b0d110
commit ef4d0aa5c5
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 8 additions and 5 deletions

View File

@ -41,12 +41,15 @@ for name in "$@"
do
if is_instance $name; then
echo "Upgrading database schema for $name"
KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
if KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
PERL5LIB=$PERL5LIB \
"$CGI_PATH/installer/data/mysql/needs_update.pl" && \
KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
PERL5LIB=$PERL5LIB \
"$CGI_PATH/installer/data/mysql/updatedatabase.pl"
"$CGI_PATH/installer/data/mysql/needs_update.pl"; then
KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \
PERL5LIB=$PERL5LIB \
"$CGI_PATH/installer/data/mysql/updatedatabase.pl"
else
echo "No database change required"
fi
else
die "Error: Invalid instance name $name"
fi