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 <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Kyle Hall 2023-08-08 07:07:34 -04:00 committed by Tomas Cohen Arazi
parent 813cfe1eec
commit 158ac7df71
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 15 additions and 1 deletions

View file

@ -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
});
},
};

View file

@ -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,