From b9c4474d8fc6001c55dc0862ed47ee9697f89316 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 14 Nov 2024 13:08:16 +0000 Subject: [PATCH] Bug 36822: (follow-up) Catch MySQL 8 failure in update We add a CAST to the fetch of 0000-00-00 dates in the database. This prevents an error in MySQL 8.0 throws htat aborts the update. Signed-off-by: Martin Renvoize --- installer/data/mysql/db_revs/240600056.pl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/installer/data/mysql/db_revs/240600056.pl b/installer/data/mysql/db_revs/240600056.pl index 82b0413128a..abe1915c4d2 100755 --- a/installer/data/mysql/db_revs/240600056.pl +++ b/installer/data/mysql/db_revs/240600056.pl @@ -12,17 +12,15 @@ return { q{ SELECT borrowernumber FROM borrowers - WHERE updated_on = '0000-00-00 00:00:00' + WHERE CAST(updated_on AS CHAR(19)) = '0000-00-00 00:00:00' } ); $sth->execute; my $results = $sth->fetchall_arrayref( {} ); - if (@$results) { sanitize_zero_date( 'borrowers', 'updated_on' ); say_info( $out, "The following borrowers' updated_on has been sanitized: " . join( ', ', map { $_->{borrowernumber} } @$results ) ); } - }, }; -- 2.47.0