From bcdd04c08b774683f2835ce96c64021c08d0b6ea Mon Sep 17 00:00:00 2001 From: Jan Kissig Date: Mon, 13 Apr 2026 17:56:56 +0000 Subject: [PATCH] Bug 42301: Fix error occuring on updatedatabase when using MySQL This patch fixes an error when running updatedatabase on an instance using MySQL by defining a key length for an unique key. The unique key in table record_sources was introduced on 35380 but was lacking a key length which works in mariaDB but fails on MySQL. Test plan: a) run ktd with mysql f.e.: DB_IMAGE=mysql:8.0 ktd --proxy --name mysql8 up -d b) enter ktd shell ktd --name mysql8 --shell c) checkout a Koha version prior to 35380. f.e. "git checkout 67adbce6562fa352b143977747fa290f23c63fde" d) run 'reset_all' e) log in and check Koha version in http://mysql8-intra.localhost/cgi-bin/koha/about.pl which should show 25.12.00.036 f) git checkout main g) restart_all h) updatedatabase will throw the following error: Upgrade to 25.12.00.037 [08:29:14]: Bug 35380 - Add new unique name to record sources, add default record sources, add is_system column to default record sources. ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: BLOB/TEXT column 'name' used in key specification without a key length at /kohadevbox/koha/C4/Installer.pm line 817 i) apply patch j) 'updatedatabase' should run without errors now Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass --- installer/data/mysql/db_revs/251200037.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/data/mysql/db_revs/251200037.pl b/installer/data/mysql/db_revs/251200037.pl index a15e3142ee..52cc301897 100755 --- a/installer/data/mysql/db_revs/251200037.pl +++ b/installer/data/mysql/db_revs/251200037.pl @@ -13,7 +13,7 @@ return { $dbh->do( q{ ALTER TABLE record_sources - ADD UNIQUE KEY name (`name`) + ADD UNIQUE KEY name (`name`(191)) } ); say $out "Added unique key 'name' ";