8163303864
MySQL requires key length for indexes of text columns, while MariaDB sets it automatically for utf8mb4. Test plan: 1. Setup Koha to use MySQL (e.g. ku-my8) 2. Downgrade database with the following commands (e.g. koha-mysql kohadev): ALTER TABLE `biblioitems` MODIFY COLUMN `publishercode` varchar(255); ALTER TABLE `biblioitems` DROP INDEX `publishercode`; ALTER TABLE `biblioitems` ADD INDEX `publishercode` (`publishercode`); ALTER TABLE `deletedbiblioitems` MODIFY COLUMN `publishercode` varchar(255); ALTER TABLE `deletedbiblioitems` DROP INDEX `publishercode`; ALTER TABLE `deletedbiblioitems` ADD INDEX `publishercode` (`publishercode`); UPDATE systempreferences SET value="23.0600006" WHERE variable = "Version"; 3. Attempt to upgrade the database (e.g. koha-upgrade-schema kohadev) 4. Notice the error about "key specification without a key length" 5. Apply patch 6. Attempt to upgrade the database (e.g. koha-upgrade-schema kohadev) 7. Notice that the database is upgraded 8. Sign off Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Perltidied the database update file. Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> (cherry picked from commit4c6517767a
) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> (cherry picked from commitb07a87ae43
) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
113 lines
3.5 KiB
Perl
Executable file
113 lines
3.5 KiB
Perl
Executable file
use Modern::Perl;
|
|
|
|
return {
|
|
bug_number => "34029",
|
|
description => "Extend datatypes in biblioitems and deletedbiblioitems tables to avoid import errors",
|
|
up => sub {
|
|
my ($args) = @_;
|
|
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `biblioitems`
|
|
MODIFY COLUMN `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)'
|
|
}
|
|
);
|
|
say $out "Updated biblioitems.place to text";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `deletedbiblioitems`
|
|
MODIFY COLUMN `place` text DEFAULT NULL COMMENT 'publication place (MARC21 260$a and 264$a)'
|
|
}
|
|
);
|
|
say $out "Updated deletedbiblioitems.place to text";
|
|
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `biblioitems`
|
|
DROP INDEX `publishercode`
|
|
}
|
|
);
|
|
say $out "Remove index on biblioitems.publishercode";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `biblioitems`
|
|
MODIFY COLUMN `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 264$b)'
|
|
}
|
|
);
|
|
say $out "Updated biblioitems.publishercode to text";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `biblioitems`
|
|
ADD INDEX `publishercode` (`publishercode`(191))
|
|
}
|
|
);
|
|
say $out "Create index on biblioitems.publishercode";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `deletedbiblioitems`
|
|
DROP INDEX `publishercode`
|
|
}
|
|
);
|
|
say $out "Remove index on deletedbiblioitems.publishercode";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `deletedbiblioitems`
|
|
MODIFY COLUMN `publishercode` text DEFAULT NULL COMMENT 'publisher (MARC21 260$b and 264$b)'
|
|
}
|
|
);
|
|
say $out "Updated deletedbiblioitems.publishercode to text";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `deletedbiblioitems`
|
|
ADD INDEX `publishercode` (`publishercode`(191))
|
|
}
|
|
);
|
|
say $out "Create index on deletedbiblioitems.publishercode";
|
|
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `biblioitems`
|
|
MODIFY COLUMN `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)'
|
|
}
|
|
);
|
|
say $out "Updated biblioitems.size to text";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `deletedbiblioitems`
|
|
MODIFY COLUMN `size` text DEFAULT NULL COMMENT 'material size (MARC21 300$c)'
|
|
}
|
|
);
|
|
say $out "Updated deletedbiblioitems.size to text";
|
|
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `biblioitems`
|
|
MODIFY COLUMN `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)'
|
|
}
|
|
);
|
|
say $out "Updated biblioitems.pages to text";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `deletedbiblioitems`
|
|
MODIFY COLUMN `pages` text DEFAULT NULL COMMENT 'number of pages (MARC21 300$a)'
|
|
}
|
|
);
|
|
say $out "Updated deletedbiblioitems.pages to text";
|
|
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `biblioitems`
|
|
MODIFY COLUMN `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)'
|
|
}
|
|
);
|
|
say $out "Updated biblioitems.illus to text";
|
|
$dbh->do(
|
|
q{
|
|
ALTER TABLE `deletedbiblioitems`
|
|
MODIFY COLUMN `illus` text DEFAULT NULL COMMENT 'illustrations (MARC21 300$b)'
|
|
}
|
|
);
|
|
say $out "Updated deletedbiblioitems.illus to text";
|
|
|
|
},
|
|
};
|