Koha/installer/data/mysql/db_revs/210600039.pl
Jonathan Druart 900bd815d1 Bug 28959: DBRev 21.06.00.039
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-10-28 17:47:46 +02:00

30 lines
861 B
Perl
Executable file

use Modern::Perl;
return {
bug_number => "28959",
description => "virtualshelves.category is really a boolean",
up => sub {
my ($args) = @_;
my ($dbh) = @$args{qw(dbh)};
unless( column_exists( 'virtualshelves', 'public' ) ) {
# Add column
$dbh->do(q{
ALTER TABLE virtualshelves
ADD COLUMN `public` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public'
AFTER `owner`;
});
# Set public lists
$dbh->do(q{
UPDATE virtualshelves
SET public = 1
WHERE category = 2;
});
# Drop old column
$dbh->do(q{
ALTER TABLE virtualshelves
DROP COLUMN `category`;
});
}
},
}