Bug 28959: Move category => public

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2021-09-07 08:06:59 -03:00 committed by Jonathan Druart
parent c9fc07aee3
commit d38be59a48
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,30 @@
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`;
});
}
},
}

View File

@ -5292,7 +5292,7 @@ CREATE TABLE `virtualshelves` (
`shelfnumber` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha',
`shelfname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'name of the list',
`owner` int(11) DEFAULT NULL COMMENT 'foreign key linking to the borrowers table (using borrowernumber) for the creator of this list (changed from varchar(80) to int)',
`category` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'type of list (private [1], public [2])',
`public` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'If the list is public',
`sortfield` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT 'title' COMMENT 'the field this list is sorted on',
`lastmodified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time the list was last modified',
`created_on` datetime NOT NULL COMMENT 'creation time',