[Koha] Another DBI Exception for foreign key constraint in upgrade to Koha

DHIM IT itmanager at dhi-moskau.org
Mon Dec 5 20:35:55 NZDT 2022


Dear all,

I had the same error. Here is the solution:

SET FOREIGN_KEY_CHECKS = 0;


ALTER TABLE issues MODIFY COLUMN borrowernumber int(11) NOT NULL COMMENT 'foreign key, linking this to the borrowers table for the patron this item was checked out to', 
MODIFY COLUMN itemnumber int(11) NOT NULL COMMENT 'foreign key, linking this to the items table for the item that was checked out'

SET FOREIGN_KEY_CHECKS = 1;


Best Regards,

Eugen Bastron



Am 04.12.22, 08:48 schrieb "Koha im Auftrag von Pablo Bianchi" <koha-bounces at lists.katipo.co.nz <mailto:koha-bounces at lists.katipo.co.nz> im Auftrag von pablo.bianchi at gmail.com <mailto:pablo.bianchi at gmail.com>>:


Thank you all for the answers!


On Sat, 3 Dec 2022 at 18:59, Katrin Fischer <katrin.fischer.83 at web.de <mailto:katrin.fischer.83 at web.de>>
wrote:


> Do you have entries in your issues table, where the borrowernumber is
> NULL?
>


Nope. In fact, *issues* has only one row, with its integer on
borrowernumber:
issue_id: 2. *borrowernumber: 53805*. issuer_id: NULL. *itemnumber: 1581.*
date_due: 2020-10-08 23:59:00. branchcode: BC. returndate: NULL.
lastreneweddate: NULL. renewals: 0. unseen_renewals: 0. auto_renew: 0.
auto_renew_error: NULL. timestamp: 2020-10-07 15:29:52. issuedate:
2020-10-07 15:29:52. onsite_checkout: 0. note: NULL. notedate: NULL.
noteseen: NULL.
On Sun, 4 Dec 2022 at 01:00, Tomas Cohen Arazi <tomascohen at gmail.com <mailto:tomascohen at gmail.com>> wrote:


> That's a data issue. Maybe an old bug let things in wrongly on the db, it
> incomplete data migration.
>
> You should do something with those checkouts with no linked patron, and
> the upgrade script will continue where it left.
>


borrowernumber (and itemnumber) are not NULL in the only row of issues
table. Also, the borrowernumber (53805) exists on borrowers table. Could be
something else?


As a last resource (I wish to avoid) I could DELETE the row. This will
always cascade any action and can't break any consistency?


JFTR, even of course upgrading to Debian 10 has nothing to do with this, I
had some trouble with Apache and Memcached and new security features of
systemd (like PrivateTmp). I had to disable them.
_______________________________________________


Koha mailing list http://koha-community.org <http://koha-community.org>
Koha at lists.katipo.co.nz <mailto:Koha at lists.katipo.co.nz>
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha <https://lists.katipo.co.nz/mailman/listinfo/koha>





More information about the Koha mailing list