Bug 40292: Add a specific error if a previous upgrade failed

We can reach an inconsistent state if the upgrade DB failed and
new_record_id has been created but renamed.

I don't think we should try to recover from this state, but have a
specific error message in this case. We will guide people asking for
help.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-10-06 10:20:45 +02:00 committed by Lucas Gass
parent c6484a3f83
commit 9e0a70fced
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 3 additions and 1 deletions

View File

@ -12,7 +12,9 @@ return {
$sth->execute();
my $column_info = $sth->fetchrow_hashref();
if ( $column_info && $column_info->{Type} eq 'int(11)' ) {
if ( column_exists('additional_field_values', 'new_record_id') ) {
die "The database is an inconsistent state, a previous upgrade went wrong. Please try a new upgrade from a previous backup and using a newest version of Koha";
} elsif ( $column_info && $column_info->{Type} eq 'int(11)' ) {
# Only run the migration if record_id is still an integer type
say_info( $out, "Converting record_id from int(11) to VARCHAR(11)...\n" );