Bugzilla – Attachment 84963 Details for
Bug 12488
Make bulkmarcimport.pl -d use DELETE instead of TRUNCATE
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12488: Make bulkmarcimport.pl -d use DELETE instead of TRUNCATE
Bug-12488-Make-bulkmarcimportpl--d-use-DELETE-inst.patch (text/plain), 1.88 KB, created by
Martin Renvoize
on 2019-02-11 10:44:15 UTC
(
hide
)
Description:
Bug 12488: Make bulkmarcimport.pl -d use DELETE instead of TRUNCATE
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2019-02-11 10:44:15 UTC
Size:
1.88 KB
patch
obsolete
>From 7f151fafb1dff6456a3cee8249e01ddeeb6dfd4e Mon Sep 17 00:00:00 2001 >From: Magnus Enger <magnus@libriotech.no> >Date: Mon, 11 Feb 2019 11:07:21 +0100 >Subject: [PATCH] Bug 12488: Make bulkmarcimport.pl -d use DELETE instead of > TRUNCATE > >On MySQL >= 5.5 bulkmarcimport.pl with the -d (delete) switch gives >an error like "Cannot truncate a table referenced in a foreign >key constraint". This patch proposes to replace the offending >TRUNCATE with DELETE. Auto incerement counters are reset to 1 to >preserve the functionality from TRUNCATE. > >To test: >- Make sure you havae a test database with some records and items >- Run bulkmarcimport.pl with the -d switch >- Observe the error described above >- Apply this patch >- Run bulkmarcimport.pl with the -d switch again >- Observe the lack of an error >- Verify that the newly imported records and items have biblionumber > and itemnumbers starting with 1 > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >https://bugs.koha-community.org/show_bug.cgi?id=21488 >--- > misc/migration_tools/bulkmarcimport.pl | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index d820d3e991..bd80a69b95 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -176,9 +176,12 @@ if ($fk_off) { > if ($delete) { > if ($biblios){ > print "deleting biblios\n"; >- $dbh->do("truncate biblio"); >- $dbh->do("truncate biblioitems"); >- $dbh->do("truncate items"); >+ $dbh->do("DELETE FROM biblio"); >+ $dbh->do("ALTER TABLE biblio AUTO_INCREMENT = 1"); >+ $dbh->do("DELETE FROM biblioitems"); >+ $dbh->do("ALTER TABLE biblioitems AUTO_INCREMENT = 1"); >+ $dbh->do("DELETE FROM items"); >+ $dbh->do("ALTER TABLE items AUTO_INCREMENT = 1"); > } > else { > print "deleting authorities\n"; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12488
:
84961
|
84963
|
85148