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
Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Roman Dolny 2025-01-20 19:18:37 +00:00 committed by Lucas Gass
parent 7b54b74b36
commit 8ec1b421bf
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 3 additions and 1 deletions

View File

@ -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("DELETE FROM auth_header");
@ -949,7 +951,7 @@ I<UNIMARC> 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<FORMAT>