From 9a613ad8425e636f1f629d7860352a868fae1bf1 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 25 Feb 2022 07:32:26 -0300 Subject: [PATCH] Bug 30182: Make background_jobs.status an ENUM Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_30182.pl | 27 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_30182.pl diff --git a/installer/data/mysql/atomicupdate/bug_30182.pl b/installer/data/mysql/atomicupdate/bug_30182.pl new file mode 100755 index 0000000000..3079761d3a --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_30182.pl @@ -0,0 +1,27 @@ +use Modern::Perl; + +return { + bug_number => "30182", + description => "Make background_jobs.status an ENUM", + up => sub { + my ($args) = @_; + my $dbh = $args->{dbh}; + + $dbh->do( + q{ + ALTER TABLE + `background_jobs` + MODIFY COLUMN + `status` ENUM( + 'new', + 'started', + 'finished', + 'cancelled' + ) COLLATE utf8mb4_unicode_ci + NOT NULL + DEFAULT 'new' + COMMENT 'Job status' + } + ); + }, +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 34a6a9665d..87303009fb 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -971,7 +971,7 @@ DROP TABLE IF EXISTS `background_jobs`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `background_jobs` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `status` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `status` ENUM('new','started','finished','cancelled') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'new' COMMENT 'Job status', `progress` int(11) DEFAULT NULL, `size` int(11) DEFAULT NULL, `borrowernumber` int(11) DEFAULT NULL, -- 2.35.1