@@ -, +, @@ --- .../data/mysql/atomicupdate/bug_28959.pl | 30 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_28959.pl --- a/installer/data/mysql/atomicupdate/bug_28959.pl +++ a/installer/data/mysql/atomicupdate/bug_28959.pl @@ -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`; + }); + } + }, +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -5271,7 +5271,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', --