Hi While trying to run database upgrade command from Koha 16.11 to 20.05 it gives following error: Upgrade to 16.12.00.003 done (Bug 17486 - Remove 'Mozilla Persona' as an authentication method) DBD::mysql::db do failed: Cannot add or update a child row: a foreign key constraint fails (`koha_library`.`deletedbiblio_metadata`, CONSTRAINT `deletedbiblio_metadata_fk_1` FOREIGN KEY (`biblionumber`) REFERENCES `deletedbiblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE) [for Statement " INSERT INTO deletedbiblio_metadata ( biblionumber, format, marcflavour, metadata ) SELECT biblionumber, 'marcxml', 'CHANGEME', marcxml FROM deletedbiblioitems; "] at /usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl line 13816. Above seems to be data loss under deletedbiblioitem etc. as per discussion over Koha mailing list?
Hi Vinod, This is a quite old update DB version, and I am not sure it makes sense to fix it as nobody else reported the problem before. To handle this you could: 1. Restore a previous version of the DB 2. Fix the id collision in deletedbiblioitems This wiki page will help you to catch the problematic entries: https://wiki.koha-community.org/wiki/DBMS_auto_increment_fix#Is_your_data_corrupted.3F Basically you need find the duplicate ID in deletedbiblio[items] tables, like: select count(*) as c, biblionumber from deletedbiblio group by biblionumber having c > 1; The easier is to remove the duplicated ID, but you may delete important data. If you want to keep the data you should modify the ID (this can be tricky, depending on the other data you have in biblio[items]) 3. Execute the updatedatabase script
(In reply to Jonathan Druart from comment #1) > Hi Vinod, > > This is a quite old update DB version, and I am not sure it makes sense to > fix it as nobody else reported the problem before. It's another 3 years later. I am closing WONTFIX.