Bug 30481: Drop unique constraint deleteditemsstocknumberidx
Resolves a sync issue between database and schema caused by differences between structure and upgrades. Note: newer databases do not contain this index any longer. Test plan: Run dbrev. Check SHOW CREATE TABLE deleteditems. Verify that unique index has been dropped, regular index added. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
35595922dd
commit
0b647518de
1 changed files with 21 additions and 0 deletions
21
installer/data/mysql/atomicupdate/bug_30481.pl
Executable file
21
installer/data/mysql/atomicupdate/bug_30481.pl
Executable file
|
@ -0,0 +1,21 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => 30481,
|
||||
description => "DB schema sync for deleteditems",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh, $out) = @$args{qw(dbh out)};
|
||||
|
||||
my $sql = "ALTER TABLE deleteditems MODIFY COLUMN `stocknumber` varchar(32) default NULL"; # removes comment in db
|
||||
$dbh->do($sql);
|
||||
if( unique_key_exists('deleteditems', 'deleteditemsstocknumberidx') ) {
|
||||
$sql = "ALTER TABLE deleteditems DROP KEY deleteditemsstocknumberidx";
|
||||
$dbh->do($sql);
|
||||
}
|
||||
if( !index_exists('deleteditems', 'delitemstocknumberidx') ) {
|
||||
$sql = "ALTER TABLE deleteditems ADD INDEX `delitemstocknumberidx` (`stocknumber`)";
|
||||
$dbh->do($sql);
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue