Koha-clms/installer/data/mysql
Pedro Amorim 5eb5d33f2f
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(`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) 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

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 94d5c37db8)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-06-22 23:48:32 +02:00
..
atomicupdate Bug 30301: DBRev 24.12.00.046 2025-05-19 18:54:34 +02:00
db_revs Bug 40057: Fix db revision 2025-06-22 23:48:32 +02:00
en Bug 36256: Port default MEMBERSHIP_EXPIRY notice to Template Toolkit syntax 2025-05-16 14:25:50 +02:00
localization Bug 27490: (follow-up) Fix custom installer files 2024-09-13 13:54:26 +02:00
mandatory Bug 26869: (QA follow-up) Fix missed sysprefs.sql 2025-05-20 15:15:34 +02:00
backfill_statistics.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
fix_unclosed_nonaccruing_fines_bug17135.pl Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
kohastructure.sql 25.05.05: Update kohastructure.sql 2025-05-26 18:45:49 +02:00
labels_upgrade.pl Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
needs_update.pl Bug 34088: Move the 'needs update' test to a separate script 2024-09-17 10:48:39 +02:00
patroncards_upgrade.pl Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
update22to30.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
updatedatabase.pl Bug 38664: Fix updatedatabase.pl 2025-02-12 06:39:59 +01:00