From b5d52f021e3e9b8a9b6f88175f8be916b7c033f9 Mon Sep 17 00:00:00 2001 From: Roman Dolny Date: Mon, 20 Jan 2025 19:18:37 +0000 Subject: [PATCH] Bug 28528: bulkmarcimport delete option doesn't delete biblio_metadata When using bulkmarcimport with the -d switch should not only delete biblio, biblioitems and items, but also biblio_metadata. I haven't checked if a FK takes care of the data, but if it does, we should still also reset the AUTO_INCREMENT:... Test plan: ========== 1. Check (and notice) the number of records in the biblio (bCount) and biblio_metadata (bmCount) tables. Check the AUTO_INCREMENT value for these tables (bAI, bmAI). 2. Import bibliographic records with delete, turn off foreign key checks and non-existent filename: misc/migration_tools/bulkmarcimport.pl -b -d -fk -file=non-exist-file ==> "Could not open..." is OK, file doesn't exist. 3. Repeat p. 1 and compare with previously noticed: bCount => 0 (OK) bmCount => unchanged (NOT OK) bAI => 1 (OK) bmAI => unchanged (NOT OK) 4. Apply the patch. 5. Repeat p. 2-3: bCount => 0 (OK) bmCount => 0 (changed, OK) bAI => 1 (OK) bmAI => 1 (changed, OK) Sponsored-by: Ignatianum University in Cracow --- misc/migration_tools/bulkmarcimport.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 70721f0529..0249997ebe 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -234,6 +234,8 @@ if ($delete) { $dbh->do("ALTER TABLE biblioitems AUTO_INCREMENT = 1"); $dbh->do("DELETE FROM items"); $dbh->do("ALTER TABLE items AUTO_INCREMENT = 1"); + $dbh->do("DELETE FROM biblio_metadata"); + $dbh->do("ALTER TABLE biblio_metadata AUTO_INCREMENT = 1"); } else { print "Deleting authorities\n"; $dbh->do("truncate auth_header"); @@ -940,7 +942,7 @@ I are supported. MARC21 by default. =item B<-d, --delete> Delete EVERYTHING related to biblio in koha-DB before import. Tables: biblio, -biblioitems, items +biblioitems, items, biblio_metadata =item B<-m>=I -- 2.39.5