Bugzilla – Attachment 112885 Details for
Bug 26853
Data lost due to "Data too long for column" errors during MARC import
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26853: Harmonize import_biblios with biblio and biblioitems
Bug-26853-Harmonize-importbiblios-with-biblio-and-.patch (text/plain), 3.22 KB, created by
David Nind
on 2020-11-03 02:52:47 UTC
(
hide
)
Description:
Bug 26853: Harmonize import_biblios with biblio and biblioitems
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-11-03 02:52:47 UTC
Size:
3.22 KB
patch
obsolete
>From ba338119262bb5c2bcd5c0756c65fcf6e83d99a0 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 29 Oct 2020 05:20:53 +0000 >Subject: [PATCH] Bug 26853: Harmonize import_biblios with biblio and > biblioitems > >This patch harmonizes the column datatypes of import_biblios >with biblio and biblioitems to prevent database errors which cause >staged MARC uploads to sometimes fail to update 100% correctly. > >To test: >1. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl >2. Upload a file with MARC records with titles longer than 128 >characters long >3. Click "Stage for import" >4. Monitor /var/log/koha/kohadev/intranet-error.log for >database errors >5. Note that there are no database errors > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../atomicupdate/001-26853-update-import_biblios.perl | 15 +++++++++++++++ > installer/data/mysql/kohastructure.sql | 12 ++++++------ > 2 files changed, 21 insertions(+), 6 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/001-26853-update-import_biblios.perl > >diff --git a/installer/data/mysql/atomicupdate/001-26853-update-import_biblios.perl b/installer/data/mysql/atomicupdate/001-26853-update-import_biblios.perl >new file mode 100644 >index 0000000000..b76413c445 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/001-26853-update-import_biblios.perl >@@ -0,0 +1,15 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ $dbh->do("DROP INDEX title ON import_biblios"); >+ $dbh->do("DROP INDEX isbn ON import_biblios"); >+ $dbh->do("ALTER TABLE import_biblios MODIFY title LONGTEXT"); >+ $dbh->do("ALTER TABLE import_biblios MODIFY author LONGTEXT"); >+ $dbh->do("ALTER TABLE import_biblios MODIFY isbn LONGTEXT"); >+ $dbh->do("ALTER TABLE import_biblios MODIFY issn LONGTEXT"); >+ $dbh->do("CREATE INDEX title ON import_biblios (title(191));"); >+ $dbh->do("CREATE INDEX isbn ON import_biblios (isbn(191));"); >+ >+ # Always end with this (adjust the bug info) >+ NewVersion( $DBversion, 26853, "Update import_biblios columns and indexes"); >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 0ed6bc202e..5418258f08 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -792,16 +792,16 @@ CREATE TABLE `import_biblios` ( > `matched_biblionumber` int(11) default NULL, > `control_number` varchar(25) default NULL, > `original_source` varchar(25) default NULL, >- `title` varchar(128) default NULL, >- `author` varchar(80) default NULL, >- `isbn` varchar(30) default NULL, >- `issn` varchar(9) default NULL, >+ `title` LONGTEXT default NULL, >+ `author` LONGTEXT default NULL, >+ `isbn` LONGTEXT default NULL, >+ `issn` LONGTEXT default NULL, > `has_items` tinyint(1) NOT NULL default 0, > CONSTRAINT `import_biblios_ibfk_1` FOREIGN KEY (`import_record_id`) > REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE, > KEY `matched_biblionumber` (`matched_biblionumber`), >- KEY `title` (`title`), >- KEY `isbn` (`isbn`) >+ KEY `title` (`title`(191)), >+ KEY `isbn` (`isbn`(191)) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26853
:
112656
|
112657
|
112658
|
112884
|
112885
|
112886
|
112888
|
112889