From d7c44ae08a4e48304d2424f70691467e993c333d Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Tue, 9 Dec 2025 17:25:09 +0000 Subject: [PATCH] Bug 41409: Convert streetnumber and B_streetnumber to tinytext Test plan: 1) Run 'updatedatabase' 2) No errors should be thrown Sponsored-by: Cheshire West and Chester Council Signed-off-by: Owen Leonard --- .../bug_41409-standardise_streetnumber.pl | 34 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 +-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_41409-standardise_streetnumber.pl diff --git a/installer/data/mysql/atomicupdate/bug_41409-standardise_streetnumber.pl b/installer/data/mysql/atomicupdate/bug_41409-standardise_streetnumber.pl new file mode 100755 index 0000000000..0c5510b5d5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_41409-standardise_streetnumber.pl @@ -0,0 +1,34 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "41409", + description => "Convert streetnumber to tinytext in borrower_modifications", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( TableExists('borrower_modifications') ) { + if ( column_exists( 'borrower_modifications', 'streetnumber' ) ) { + $dbh->do( + q{ + ALTER TABLE borrower_modifications CHANGE COLUMN streetnumber streetnumber tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address'; + } + ); + say_success( + $out, + q{Column 'borrower_modifications.streetnumber' renamed to 'borrower_modifications.streetnumber'} + ); + $dbh->do( + q{ + ALTER TABLE borrower_modifications CHANGE COLUMN B_streetnumber B_streetnumber tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s alternate address'; + } + ); + say_success( + $out, + q{Column 'borrower_modifications.B_streetnumber' renamed to 'borrower_modifications.B_streetnumber'} + ); + } + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 688c7883f0..e65b2af7ca 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1417,7 +1417,7 @@ CREATE TABLE `borrower_modifications` ( `othernames` longtext DEFAULT NULL, `initials` mediumtext DEFAULT NULL, `pronouns` longtext DEFAULT NULL, - `streetnumber` varchar(10) DEFAULT NULL, + `streetnumber` tinytext DEFAULT NULL, `streettype` varchar(50) DEFAULT NULL, `address` longtext DEFAULT NULL, `address2` mediumtext DEFAULT NULL, @@ -1431,7 +1431,7 @@ CREATE TABLE `borrower_modifications` ( `fax` longtext DEFAULT NULL, `emailpro` mediumtext DEFAULT NULL, `phonepro` mediumtext DEFAULT NULL, - `B_streetnumber` varchar(10) DEFAULT NULL, + `B_streetnumber` tinytext DEFAULT NULL, `B_streettype` varchar(50) DEFAULT NULL, `B_address` varchar(100) DEFAULT NULL, `B_address2` mediumtext DEFAULT NULL, -- 2.39.5