https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40057

Pedro Amorim <pedro.amo...@openfifth.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #182919|0                           |1
        is obsolete|                            |

--- Comment #4 from Pedro Amorim <pedro.amo...@openfifth.co.uk> ---
Created attachment 182988
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182988&action=edit
Bug 40057: Fix db revision

Test plan (ktd):
1) reset_all
2) Run first part of the 241200017.pl atomicupdate manually
        koha-mysql kohadev
        ALTER TABLE illrequests DROP FOREIGN KEY illrequests_bnfk;
3) Create an ILL request linked to a borrower that doesn't exist (simulate old
data):
        INSERT INTO illrequests (`backend`, `borrowernumber`,`branchcode` )
VALUES ('Standard', '99999', 'CPL');
4) Run the 2nd part of the atomicupdate manually:
        ALTER TABLE illrequests ADD CONSTRAINT illrequests_bnfk
        FOREIGN KEY()
        REFERENCES  ()
        ON DELETE SET NULL ON UPDATE CASCADE;
5) Notice you get the error:
        ERROR 1452 (23000): Cannot add or update a child row: a foreign key
constraint fails (., CONSTRAINT  FOREIGN KEY () REFERENCES  () ON DELETE SET
NULL ON UPDATE CASCADE)
6) Run the added query in the patch:
        UPDATE illrequests SET borrowernumber = NULL WHERE borrowernumber NOT
IN (SELECT borrowernumber FROM borrowers);
7) Repeat step 4)
8) Notice there's no errors

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to