From ba591ecb0ff7ec4249ade65991242407eb605c05 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 8 Aug 2023 07:07:34 -0400 Subject: [PATCH] Bug 34494: Table tmp_holdsqueue fails to be created for MySQL 8 It appears that MySQL 8 rejects creating any table where the primary key is nullable. The table tmp_holdsqueue has a nullable pk ( itemnumber ) but there is no reason for this column to be nullable ( generating a holds queue entry with no itemnumber is not possible ) so it make sense to just remove the nullability for MySQL compatiability. Test Plan: 1) Using MySQL 8.0, attempt to create a database from kohastructure.sql If you use ktd, you can try: DB_IMAGE=mysql:8.0 ktd up 2) Note the failure to create the table 3) Apply this patch 4) Repeat step 1 5) The table is created! Signed-off-by: David Nind Signed-off-by: Victor Grousset/tuxayo --- .../data/mysql/atomicupdate/fix_tmp_holdsqueue.pl | 14 ++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/fix_tmp_holdsqueue.pl diff --git a/installer/data/mysql/atomicupdate/fix_tmp_holdsqueue.pl b/installer/data/mysql/atomicupdate/fix_tmp_holdsqueue.pl new file mode 100755 index 0000000000..8f9346d929 --- /dev/null +++ b/installer/data/mysql/atomicupdate/fix_tmp_holdsqueue.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "34494", + description => "Fix tmp_holdsqueue for MySQL compatiability", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do(q{ + ALTER TABLE tmp_holdsqueue CHANGE COLUMN itemnumber `itemnumber` int(11) NOT NULL + }); + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index c1f800fe7f..0943df54e5 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -5870,7 +5870,7 @@ DROP TABLE IF EXISTS `tmp_holdsqueue`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tmp_holdsqueue` ( `biblionumber` int(11) DEFAULT NULL, - `itemnumber` int(11) DEFAULT NULL, + `itemnumber` int(11) NOT NULL, `barcode` varchar(20) DEFAULT NULL, `surname` longtext NOT NULL, `firstname` mediumtext DEFAULT NULL, -- 2.41.0