[Koha] Wipe Koha database (just auth and biblio records)
Pablo Bianchi
pablo.bianchi at gmail.com
Wed Jun 4 03:21:46 NZST 2014
Hi Robin!
So you agree with me that Appendix F ("Resetting the Koha Database") of
current (v3.16) manual is wrong?
2014-06-02 20:21 GMT-03:00 Robin Sheat <robin at catalyst.net.nz>:
> Pablo Bianchi schreef op ma 02-06-2014 om 14:33 [-0300]:
> > Am I right? This could be risky, having side effects?
>
> This could have nasty side-effects.
>
> By turning off the
>
> constraint checks, you're not going to have any
> messages telling you reasons why you shouldn't do what you're doing. For
> example, circulation history, serial subscriptions, reserves, and
> anything else that links with biblios and/or items aren't going to be
> cleared. This means that you'll have entries in them pointing to things
> that don't exist.
>
Problems that we can avoid just with *DELETE FROM biblio*?
> Some better solutions might be to:
> * Do 'DELETE FROM table;' and then reset the auto numbering back
> to 1, something like 'ALTER TABLE table AUTO INCREMENT=1;'
> This'll ensure that things that should be deleted via
> constraints will be, or it won't let you do it. Also ensure that
> things that aren't constraint-linked are deleted (I think
> old_issues is one of these.)
>
Despite the autoincrement issue, the *DELETE FROM biblio* way wasn't
working for me. Now I'm not being able to reproduce the error, but I
remember was very similar than with truncate, about *foreign key constraint*
*.*
I wonder why with -d option of bulkmarcimport.pl I had similar problems
than with TRUNCATE, throw to stderr something like:
*#1701 - Cannot truncate a table referenced in a foreign key constraint
> (`koha_MyInstance`.`aqorders`, CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY
> (`biblionumber`) REFERENCES `koha_MyInstance`.`biblio` (`biblionumber`))*
>
What we can expect just taking a look to the source code:
*if ($delete) {*
* if ($biblios){*
* print "deleting biblios\n";*
* $dbh->do("truncate biblio");*
* $dbh->do("truncate biblioitems");*
* $dbh->do("truncate items");*
* } else {*
* print "deleting authorities\n";*
* $dbh->do("truncate auth_header");*
* }*
* $dbh->do("truncate zebraqueue");*
*}*
If this way is the right one, considering constraint checks, I can't see
why we can't use it. Perhaps we can set up something differently in
my.cnf...
Regards,
Pablo
More information about the Koha
mailing list