Bug 36978: (Bug 34029 follow-up) Make update idempotent

The update wasn't checking for index pre-existance and as such could
fail in certain cases.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2024-06-04 12:51:45 +01:00
parent 900a1aecbb
commit 1daccb71be
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 9 additions and 18 deletions

View File

@ -21,13 +21,10 @@ return {
);
say $out "Updated deletedbiblioitems.place to text";
$dbh->do(
q{
ALTER TABLE `biblioitems`
DROP INDEX `publishercode`
if ( index_exists( 'biblioitems', 'publishercode' ) ) {
$dbh->do(q{ALTER TABLE `biblioitems` DROP INDEX `publishercode`});
say $out "Remove index on biblioitems.publishercode";
}
);
say $out "Remove index on biblioitems.publishercode";
$dbh->do(
q{
ALTER TABLE `biblioitems`
@ -35,20 +32,14 @@ return {
}
);
say $out "Updated biblioitems.publishercode to text";
$dbh->do(
q{
ALTER TABLE `biblioitems`
ADD INDEX `publishercode` (`publishercode`(191))
}
);
$dbh->do(q{ALTER TABLE `biblioitems` ADD INDEX `publishercode` (`publishercode`(191))});
say $out "Create index on biblioitems.publishercode";
$dbh->do(
q{
ALTER TABLE `deletedbiblioitems`
DROP INDEX `publishercode`
if ( index_exists( 'deletedbiblioitems', 'publishercode' ) ) {
$dbh->do(q{ALTER TABLE `deletedbiblioitems` DROP INDEX `publishercode`});
say $out "Remove index on deletedbiblioitems.publishercode";
}
);
say $out "Remove index on deletedbiblioitems.publishercode";
$dbh->do(
q{
ALTER TABLE `deletedbiblioitems`